Tutorial: View.triggerBeforeUnload

View.triggerBeforeUnload

Triggers the before-unload handler for the View, if one is set. Returns true if the handler is trying to prevent the View from unloading and false if it isn't. Only enabled when setting enableBeforeUnload: true in your View options. If this option is not enabled it will always return false.

This method is used internally by the Platform Provider to determine the status of each before unload handler in Views when closing the Window.

Example

// from inside a View context
const unloadPrevented = await fin.me.triggerBeforeUnload();