appProcess.current.setOnDispose
API reference for the appProcess.current.setOnDispose method.
Registers a callback that runs when the current process is about to close.
Usage
import { appProcess } from "@canva/platform";appProcess.current.setOnDispose((context) => {console.log(context.reason); // => "completed"});
tsx
Parameters
Required
The callback to run before the current process closes.
Required
Information passed to the callback before the current process closes.
Required
The reason the current process closed.
The possible values are:
"completed"
- Indicates that a workflow is complete, and any unsaved changes should be saved."aborted"
- Indicates that a workflow has been aborted, and unsaved changes should be ignored.
Returns
A disposer function that cleans up the registered callback.