onTouchModeExit
API reference for the "onTouchModeExit" method.
This callback only runs when the user clicks the Done or Cancel button. This callback doesn't run when an extension disables touch mode with the
toggleTouchMode
method.const canva = window.canva.init();
canva.onReady(async (opts) => {
console.log("Entering touch mode...");
canva.toggleTouchMode(true);
});
canva.onTouchModeExit((opts) => {
if (opts.commit) {
console.log("You clicked the 'Done' button.");
} else {
console.log("You clicked the 'Cancel' button.");
}
console.log("Exited touch mode.");
});
Name | Type | Required | Description |
---|---|---|---|
handler | Yes | The callback to run when the user exits touch mode. |
void
The callback to run when the user exits touch mode.
Signature
(opts) => void
Parameters
Name | Type | Required | Description |
---|---|---|---|
opts | object | Yes | Information about the event. |
opts.commit | boolean | Yes | If true , the user clicked the Done button. If false , the user clicked the Cancel button. |
Returns
void
Last modified 1yr ago