Updated AsyncFunction (markdown)

Namhyeon Go 2024-08-06 21:24:11 +09:00
parent 298c2afb55
commit 7552c01f14

@ -27,22 +27,22 @@ var STD = require("lib/std");
function onShoutcut(args) { function onShoutcut(args) {
[5, 4, 3, 2, 1].forEach(function(x) { [5, 4, 3, 2, 1].forEach(function(x) {
new AsyncFunction('sub_01', '[module name]').run(x); sub_01.run();
}); });
} }
function _async_sub_01(args) { var sub_01 = new AsyncFunction(function(args) {
var x = args[0]; var x = args[0];
sleep(x * 1000); sleep(x * 1000);
console.log(x); console.log(x);
} });
function main(args) { function main(args) {
if (!AsyncFunction.bind(exports, args)) { AsyncFunction.bind(exports, args); // if this is completed, stop with AsyncFunction.Resolved exception
onShoutcut(args); onShoutcut(args);
} }
}
exports.main = main; exports.main = main;
exports.onShoutcut = onShoutcut; exports.onShoutcut = onShoutcut;