Docs
v4
API Docs

Events

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

const editor = new PhotoEditorSDK.UI.ReactUI(/* ... */)
editor.on('export', (result) => {
  console.log('User clicked export, resulting image / dataurl:')
  console.log(result)
})

See the documentation for available UI events.

Some people use the export event to find out which operations the user has applied to the image:

const editor = new PhotoEditorSDK.UI.ReactUI(/* ... */)
editor.on('export', (result, editor) => {
  // User has clicked export, find out what operations he used
  const stack = editor.getOperationsStack()
  console.log('User used operations:')
  stack.forEach((operation) => {
    console.log(operation.constructor.identifier)
  })
})

Example output:

User used operations:
orientation
crop
filter
border
sprite