Docs
API Docs

Events

The UI emits events that let you know what happens inside the editor. Most users use these events for dealing with data differently. You can listen to them by calling the UI’s on method:

import { UIEvent, PhotoEditorSDKUI } from 'photoeditorsdk'

const editor = new PhotoEditorSDKUI(/* ... */)

editor.on(UIEvent.EXPORT, (result) => {
  console.log('User clicked export, resulting image / dataurl:')
  console.log(result)
})

There are four main UIEvents available

enum UIEvent {
  EXPORT = 'export', // will be fired when an image is exported
  CLOSE = 'close', // will be fired when the close button on editor UI is clicked
  HISTORY_CHANGE = 'historyChange', // will be fired when history changes
  EDITOR_READY = 'editorReady', // will be fired at the beginning when editor is ready
  ERROR_IMAGE_LOADING = 'errorImageLoading' // will be fired if the image could not be loaded
}