Is the order preserved in execution of doc operations?

Doc methods like setValue are executed in batches. Is the order preserved while executing the operations? If I call the setValue function and then I call setCursor (after calling focus), will they execute in the same order that I call them?

Such methods are executed immediately, in regards to the editor’s internal state. Only the display updates are batched (with operations).

Thank you so much for the response, @marijn. What I’m trying to understand is if I call setValue first and then setCursor then after all the operations are done, will the cursor now be on the new position (that I specify) or at the beginning (which is set due to the call to setValue function) ? Thanks.

Yes. After you call setValue the document has been updated and you can move the cursor in the new document.

1 Like