It might not be so obvious because setFrame occurs so quickly. But I have an animate function that calls setFrame in quick succession using a series of intermediate frames. It's more apparent in that situation: show executes after all the setFrames.
Modal.build(...).show();
animateSetFrame(...);
function animateSetFrame(window, origFrame, destFrame) {
... // a set loop of window.setFrame()
}
Interestingly, if I wrap setFrame in a zero-delay Timer, show() will fire before setFrame.
Modal.build(...).show();
new Timer(0, false, () => Window.focused().setFrame(...)); // or using animateSetFrame()
I don't mind refactoring my code and functions to account for the necessary Timers, but it will just make my code a lot less readable and easy to understand. I'm also wondering if I'm using the API incorrectly somehow, leading to these effects. In addition, the same things happen when I assign the Modal or Timer to a variable.
In the following code,
setFrame()
happens beforeshow()
even though it is written after.It might not be so obvious because
setFrame
occurs so quickly. But I have ananimate
function that callssetFrame
in quick succession using a series of intermediate frames. It's more apparent in that situation:show
executes after all thesetFrame
s.Interestingly, if I wrap setFrame in a zero-delay Timer,
show()
will fire before setFrame.I don't mind refactoring my code and functions to account for the necessary Timers, but it will just make my code a lot less readable and easy to understand. I'm also wondering if I'm using the API incorrectly somehow, leading to these effects. In addition, the same things happen when I assign the
Modal
orTimer
to a variable.