You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
myDelay.onceComplete called
Stopping myDelay
Stopped myDelay
Sample code:
<!doctype html><html><head><scripttype="text/javascript" src="./tina.js"></script></head><body><script>varduration=3;varmyDelay=newTINA.Delay(duration);myDelay.onceComplete(function(){console.log('myDelay.onceComplete called');});myDelay.start();vard2=newTINA.Delay(0);// bug also appears with a delay of 1d2.onceComplete(function(){console.log('Stopping myDelay');myDelay.stop();console.log('Stopped myDelay');});d2.start();</script></body></html>
The text was updated successfully, but these errors were encountered:
ronkorving
changed the title
Delay.onceComplete does not fire predictably
Delay.onceComplete can fire after stop()
Aug 1, 2017
ronkorving
changed the title
Delay.onceComplete can fire after stop()
Delay.onceComplete can fire "after" stop()
Aug 1, 2017
Discussed this yesterday with @cainmartin and @jrouault and I believe the consensus on this at the moment is (correct me if I'm wrong) the following.
The resolution of event emission order is no smaller than a single tick. If both onceComplete events land in the same tick, the order is likely to be consistently first-registered followed by 2nd-registered (so we see "myDelay.onceComplete called" first). But sometimes, the two events will be in separate ticks, in which case the longer delay will always be in the 2nd tick and thus be stopped correctly.
This is probably as-good-as-it-gets, and I personally don't consider this an issue with TINA.
After further investigation, we decided that an elegant solution would be to allow a tween to be destroyed, even if active, avoiding its events being emitted from that moment on. @jrouault will submit a pull request to expose such functionality.
Expected output:
Actual output (50% of the time):
Sample code:
The text was updated successfully, but these errors were encountered: