web icon indicating copy to clipboard operation
web copied to clipboard

Expose hideLoadingScreen and hideLoadingScreenNow

Open f0rr0 opened this issue 4 years ago • 1 comments

Expose hideLoadingScreen and hideLoadingScreenNow to consumers.

Since showLoading mutates DOM, consumers can call these methods to clean up side-effects or bail early from an 8thWall session. For instance if I am inside a SPA and the user decides to exit the 8thwall route before the loading has finished, I would call these methods to cleanup the loading DOM mutations.

f0rr0 avatar Mar 24 '21 02:03 f0rr0

Hi @f0rr0, thanks the suggestion! The R17.1 engine release added a new lifecycle event, onRemove, which is called when a pipeline module is removed. Along with that we updated loading-module.js to call hideLoadingScreenNow() in onRemove. This should lead to the loading module cleaning itself up when you exit an 8th Wall experience, which is something it didn't do well before.

Does this solve your issue? With it you shouldn't need to call hideLoadingScreen or hideLoadingScreenNow yourself, instead the pipeline module should clean itself up. If not I'd love to learn more about what's missing for your scenario. Thanks!

https://github.com/8thwall/web/pull/184/files#diff-f408e456fa730f212ad9756d053d59f2e4b9dfc9f5630dd42e7af6ac4dc84081R450

jparismorgan avatar Sep 23 '21 16:09 jparismorgan