Read vs. write phases

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.?

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.