onTouchModeExit
API reference for the "onTouchModeExit" method.
Registers a callback that executes when a user exits touch mode.
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.

Usage

1
const canva = window.canva.init();
2
3
canva.onReady(async (opts) => {
4
console.log("Entering touch mode...");
5
canva.toggleTouchMode(true);
6
});
7
8
canva.onTouchModeExit((opts) => {
9
if (opts.commit) {
10
console.log("You clicked the 'Done' button.");
11
} else {
12
console.log("You clicked the 'Cancel' button.");
13
}
14
15
console.log("Exited touch mode.");
16
});
Copied!

Parameters

Name
Type
Required
Description
handler
Yes
The callback to run when the user exits touch mode.

Returns

void

Types

TouchModeExitHandler

The callback to run when the user exits touch mode.
Signature
1
(opts) => void
Copied!
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