# Read vs. write phases

**URL:** <https://discuss.prosemirror.net/t/read-vs-write-phases/185>\
**Category:** Uncategorized\
**Created:** [February 17, 2016, 4:36pm UTC](https://discuss.prosemirror.net/t/read-vs-write-phases/185 "2016-02-17T16:36:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![johanneswilm](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/johanneswilm/32/19_2.png) [@johanneswilm](https://discuss.prosemirror.net/u/johanneswilm)\
**Post date:** [February 17, 2016, 4:36pm UTC](https://discuss.prosemirror.net/t/read-vs-write-phases/185/1 "2016-02-17T16:36:47Z")

</div>

Hey, I have been wondering about how the update scheduler is supposed to be used with it’s write vs. read phases.

1. Does “DOM writing” include all writing, also to parts of the DOM that are not part of prosemirror at all?

2. What about things that have their own scheduling systems for drawing things to the DOm such as Mathjax?

3. What about simple operations such as

The first part ( jQuery(’.buttons’) ) will of course read from the DOM, whereas the second part (addClass(‘disabled’) ) will write to it. Should this be split up into two operations where the fisst one is executed during a read phase and the second one during a write phase? Or does “read” only apply to measuring distance, colors, values, etc.?

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)\
**Post date:** [February 18, 2016, 9:51am UTC](https://discuss.prosemirror.net/t/read-vs-write-phases/185/2 "2016-02-18T09:51:08Z")

</div>

This is an optimization. You’re free to trigger your own DOM writes, especially when needed at a time that doesn’t correspond to a ProseMirror display update.

I haven’t looked into connecting this to other schedulers yet. If your system already has a `requestAnimationFrame` update pump running, it would be possible to have ProseMirror use that, rather than set its own, but I haven’t tried that yet. Note that this would only be relevant if both components need to update at the same time.

As for a query like `jQuery('.buttons')`, that isn’t going to require a relayout, so that’s not something that you should worry about synchronizing.
