What events are available to hook into with the Editor?


#1

I was just wondering whether I can add custom behaviour to the save or run buttons.


#2

currently we expose the following events:

  • didLoadWebtask
  • beforeRemoveWebtask
  • didRemoveWebtask
  • beforeSaveWebtask
  • didSaveWebtask
  • beforeRunWebtask
  • didRunWebtask

you can attach to them by using:

ExtendEditor.on('didSaveWebtask', function (data) {
  console.log('didSaveWebtask', data);
});

Available Events

  • didLoadWebtask
// callback `data` param
{
  name: 'webtask-name'
}
  • beforeRemoveWebtask
// callback `data` param
{
  name: 'webtask-name'
}
  • didRemoveWebtask
// callback `data` param
{
  name: 'webtask-name'
}
  • beforeSaveWebtask
// callback `data` param
{
  name: 'webtask-name'
}
  • didSaveWebtask
// callback `data` param
{
  name: 'webtask-name'
}
  • beforeRunWebtask
// callback `data` param
{
  data: 'raw-data',
  headers: {},
  method: 'get',
  params: {},
  url: 'webtask-url'
}
  • didRunWebtask
// callback `data` param
{
  body: 'raw-body',
  headers: {},
  method: 'post',
  status: 200
}

Error handling

Listening to errors

ExtendEditor.on('error', (data) => {
  // Your code here
});

Error callback data param

{
  type: 'error:type',
  error: {} // Raw error
}

Error Types

  • cron:read: Error loading a cron.
  • cron:schdule: Error scheduling a cron.
  • cron:history: Error reading cron history.
  • cron:unschedule: Error unscheduling a cron.
  • cron:update: Error updating a cron.
  • storage:update: Error updating webtask storage.
  • storage:read: Error reading webtask storage.
  • webtask:delete: Error deleting a webtask.
  • webtask:create: Error creating a webtask.
  • webtask:update: Error updating a webtask.
  • webtask:inspect: Error inspecting a webtask.
  • webtask:load: Error loading a webtask.
  • editor:load: The function editor could no be loaded.
  • categories:load: Error loading remote categories.
  • config:load: Error loading remote configuration.

#3

All of this should be documented here as well: https://goextend.io/docs/extend-editor#editor-events


#4

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.