exteranto / framework

The Exteranto browser extension framework core packages.
https://exteranto.github.io
MIT License
5 stars 4 forks source link

Feature improve window load handling #149

Closed haydnba closed 4 years ago

haydnba commented 4 years ago

We recently faced an issue with the WindowLoad event being triggered twice by an SPA which somehow dispatched native window.onload event twice. This is rare but possible and it causes issues in particular for how we inject data into the content page (e.g. custom scripts duplicated....). I have added a { once: true } option to the registration of the event on native window load, which prevents this issue.

Further, we felt it may be useful to be able to trigger events/messages on the 'domcontentloaded' event as well as full page load - this will hopefully allow for increase in perceived performance in many circumstances (alternative would be to trigger many processes on the AppBootedEvent which we may still do although this could clearly lead to problems with message registration etc.