async-invoker
v1.1.3
Published
Create a runner of code asynchronous
Downloads
463
Readme
Async invoker
Create a promise with result of the invoke your code.
Sync function - example
AsyncInvoker = require "async-invoker"
code = " function (a, b) { return a + b; } "
new AsyncInvoker(code)
.invoke (1, 2)
.tap console.log # 3
Async function - example
AsyncInvoker = require "async-invoker"
code = " function (callback) { callback(1 + 2); } "
new AsyncInvoker(code)
.invoke()
.tap console.log # 3