Registers a callback that runs when an overlay for the specified target can or can't be opened.
To learn more, see Creating image overlays.
Usage
import { overlay } from "@canva/design";overlay.registerOnCanOpen({target: "image_selection",onCanOpen: (event) => {console.log(event.canOpen);},});
tsx
Parameters
Required
The options for registering the callback.
Required
The target to check if an overlay can be opened for. The only supported option is "image_selection"
.
Required
The callback that runs when an overlay for the specified target can or can't be opened.
Required
Information about the event.
Required
If true
, an overlay can be opened for the specified target.
Required
Opens an overlay for the specified target.
Returns
A disposer function that cleans up the registered callback.