onImageUpdate

API reference for the "onImageUpdate" method.

Registers a callback that runs when Canva requests the extension to update the user's image.

The onImageUpdate callback runs immediately before the onSaveRequest callback.

Usage

const canva = window.canva.init();
canva.onReady(async (opts) => {
// This callback must exist for the extension to start
});
canva.onImageUpdate(async (opts) => {
console.log(opts);
});

Parameters

Name

Type

Required

Description

handler

ImageUpdateHandler

Yes

The callback that runs when Canva requests the extension to update the user's image.

Returns

void

Types

ImageUpdateHandler

The callback that runs when Canva requests the extension to update the user's image.

Signature

(opts) => void

Parameters

Name

Type

Required

Description

opts

object

Yes

Information about the event.

opts.image

CanvaImageBlob

Yes

The updated version of the user's image.

Returns

void