onClose
onClose
Called when the form closes.
Parameters: None
Returns: Future<void> — you can handle it asynchronously and wait for closing work to finish before the form goes away.
Description
Called when the user closes the page or exits the app. The event propagates recursively to any open child forms and popups. Use it for wrap-up work: releasing resources, saving state, writing logs.
Example
async function onClose() {
$log.i("form closing");
await $vm.unsubscribeData("liveTicker");
}
Related and cautions
- When a parent form closes with popups or child forms open,
onClosepropagates to those children in order. - This is the only Form/Page event you can write asynchronously — put any async work that must finish before closing here, such as sending a final state to the server.