Expand beforeInit event to allow halting of init event
imakewebthings opened this issue · comments
Folks need to ensure some things happen beforeInit, while transforming the deck in some way during beforeInit
. Some of those things are async so init gets fired before they're ready. This is the remedy:
- beforeInit event gets two new methods,
lockInit
andreleaseInit
. - Calling
lockInit
will prevent theinit
event from firing untilreleaseInit
is called on the same event. - Firing of init will wait until all locks are released.
- There will be a timeout limit for locks, with warning or error if that time limit is reached.
@twitwi This is in master now. Would love for you to try it out. The interface is as described in the ticket. Default timeout for lock release is 10 seconds.
@imakewebthings Very good. I could try and it seems to be working well with my extensions. I only had to also fill the slide array before calling the preinit (as the extensions are relying on it to be filled). See #156
This reminded me of my very old pull request #80 (error 500 on github for me :( )
This is included in the 1.1.0 release.
Thanks.