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

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.");
});

Parameters

Name

Type

Required

Description

handler

TouchModeExitHandler

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

(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