nel
nel copied to clipboard
Asynchronous transpiling fix
Related to issue #12
Changes:
- The previous fix would
sendTasktwice with asynchronous code. This addssendTaskto anelsestatement in_runNowso that runs in either the transpiling OR if the transpiler isn't run. - Uses a
Promiseif it exists; otherwise does thetry / catchinside a polyfill. Should make the code easier to upgrade if / when bumping up to a new version of node.js; and makes it easier to read in the meantime.
This return should ensure sendTask is run only once. If you're really convinced this is happening, I'll try to reproduce the issue, but I need to be able to reproduce it, so that I can write a test.