paed01/bpmn-engine

lib/JavaScript missing callback

Closed this issue · 3 comments

lib/JavaScript missing callback leads to flow not continue execute
function javaScript(language, filename, scriptBody) { const script = new Script(scriptBody, {filename}); return { script, language, execute(executionContext, callback) { const result = script.runInNewContext({...executionContext, next: callback}); if (callback) { return callback(null, result); } return result; } }; }

You can make your own and pass it as option scripts.

This was a breaking change in v11. Sorry about that, but the solution was inconsistent.

You can have a try with making script synchronous with your own script handler, but the default is that next must be called. I made an attempt to detect if next is called in the script body using regexp - but realized, eventually, that it was just easier change flow script conditions.

okok~~ thank u