小编Par*_*wan的帖子

Nodejs按顺序运行任务

我是node.js的新手,我不知道如何在另一个函数之前执行settimeout函数,

例如,

var async = require('async');
function hello(){
    setTimeout(function(){
        console.log('hello');
    },2000);}

function world(){
    console.log("world");
}
async.series([hello,world()]);
Run Code Online (Sandbox Code Playgroud)

输出总是世界问候.

我正在使用图书馆吗?我不是这个问题似乎微不足道但我真的不知道如何强迫一个简短的任务在长期之后运行

node.js async.js

4
推荐指数
1
解决办法
3394
查看次数

标签 统计

async.js ×1

node.js ×1