Skip to content

Commit

Permalink
feat(scheduler): action can be async function
Browse files Browse the repository at this point in the history
  • Loading branch information
epaminond committed Jun 29, 2018
1 parent 2172f70 commit ab1832a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/functionals/botpress-scheduler/src/daemon.js
Expand Up @@ -28,7 +28,8 @@ const createDaemon = bp => {
return
}

const fn = new Function('bp', 'task', expired.action)
const AsyncFunction = eval('Object.getPrototypeOf(async function() {}).constructor') // eslint-disable-line no-eval
const fn = new AsyncFunction('bp', 'task', expired.action)

bp.events.emit('scheduler.update')
bp.events.emit('scheduler.started', expired)
Expand Down

0 comments on commit ab1832a

Please sign in to comment.