« Back to the index

eventManager page loading and unloading examples

The code will hook a page load and a page unload listener:

There are only 1 possible event called upon page load.
The event is called once the full page has been loaded (HTML code and JS code).
This event may be called before load the images and style sheets.

There are 2 events called upon a page unload: 1. the beforeFlush event will happen when the user fires an event to quit the page (browser close, URL change, click on a link, etc.). The method may return a string to display to the user and ask a question.
In this case, the user may disaple the exit of the page.
This event should be used to ask to the user if he wants to exit the page (for example if he did not saved a data, etc.)
2. the afterFlush event will happen once the user has accepted the exit of the page and after unloading all the other managers.
This event should me used to unload objects and data structures.



« Back to the index