Tries to track the loading status of the page. It may fallback to using timeouts or DOMContentLoaded events to address browser compatibilities: in such
cases there is a chance that the registered onload handlers are fired before the actual onload is. Also unload and beforeunload may not fire at all.
Method Summary
- addBeforeUnloadHandler
- Adds a handler for the onbeforeunload event.
- addOnloadHandler
- Adds a handler for the load event.
- addUnloadHandler
- Adds a handler for the unload event.
- isLoaded
- Checks if the load event has been fired.
- isUnloaded
- Checks if the unload event has been fired.
- isUnloading
- Checks if the unload event is currently being handled.
- removeBeforeUnloadHandler
- Removes the specified onbeforeunload handler if present, otherwise it does nothing.
- removeOnloadHandler
- Removes the specified load handler if present, otherwise it does nothing.
- removeUnloadHandler
- Removes the specified unload handler if present, otherwise it does nothing.
Method Detail
-
<static> addBeforeUnloadHandler(the)
-
Adds a handler for the onbeforeunload event.
Parameters:
Name Type Description the
function | EnvironmentStatusListener function to be executed or an object containing the preUnloadEvent function to be executed. -
<static> addOnloadHandler(the)
-
Adds a handler for the load event. If the event was already fired the handler is sent in a setTimeout (with a 0 timeout).
Parameters:
Name Type Description the
function | EnvironmentStatusListener function to be executed or an object containing the onloadEvent function to be executed. -
<static> addUnloadHandler(the)
-
Adds a handler for the unload event. If the event was already fired the handler is sent in a setTimeout (with a 0 timeout).
Parameters:
Name Type Description the
function | EnvironmentStatusListener function to be executed or an object containing the unloadEvent function to be executed. -
<static> isLoaded() → {Boolean}
-
Checks if the load event has been fired.
Returns:
true if the load event has already been fired, false otherwise.- Type
- Boolean
-
<static> isUnloaded() → {Boolean}
-
Checks if the unload event has been fired.
Returns:
true if the unload event has already been fired, false otherwise.- Type
- Boolean
-
<static> isUnloading() → {Boolean}
-
Checks if the unload event is currently being handled.
Returns:
true if the unload event is currently being handled, false otherwise.- Type
- Boolean
-
<static> removeBeforeUnloadHandler(the)
-
Removes the specified onbeforeunload handler if present, otherwise it does nothing.
Parameters:
Name Type Description the
function | EnvironmentStatusListener function or object to be removed. -
<static> removeOnloadHandler(the)
-
Removes the specified load handler if present, otherwise it does nothing.
Parameters:
Name Type Description the
function | EnvironmentStatusListener function or object to be removed -
<static> removeUnloadHandler(the)
-
Removes the specified unload handler if present, otherwise it does nothing.
Parameters:
Name Type Description the
function | EnvironmentStatusListener function or object to be removed