tmedwards / sugarcube-2

SugarCube is a free (gratis and libre) story format for Twine/Twee.
https://www.motoslave.net/sugarcube/2/
BSD 2-Clause "Simplified" License
177 stars 41 forks source link

Change how <<done>> works #126

Closed tmedwards closed 2 years ago

tmedwards commented 3 years ago

The current version of <<done>> isn't suitable for all uses. In particular, if being used to wait for slow DOM updates it can execute too soon.

The, likely best, solution is to switch from using the :passagedisplay event to an Engine.minDomActionDelay timeout, so we can be sure that the DOM is ready for whatever the user is up to.

For example:

setTimeout(this.createShadowWrapper(
    () => $.wiki(contents)
), Engine.minDomActionDelay);
tmedwards commented 2 years ago

Resolved by commit c20ffd1 .