API reference
Design
Platform
appProcess.registerOnStateChange
API reference for the appProcess.registerOnStateChange method.
This version of the API is deprecated. This version will soon be unsupported. You should use a stable version of the API in your app.
Registers a callback that runs when the state of a process changes.
Usage
import { appProcess } from "@canva/platform";appProcess.current.registerOnStateChange("ID GOES HERE", (context) => {console.log(context.state); // => "open"});
TSX
Parameters
target
string
RequiredThe ID of a process.
callback
function
RequiredThe callback to run when the state of the process changes.
callback(context)
object
RequiredInformation passed to the callback when the state of the process changes.
callback(context.state)
string
RequiredThe state of the process.
The possible values are:
"opening"
"open"
"closing"
"closed"
Returns
A disposer function that cleans up the registered callback.