function a()
in async function :
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var dbo = db.db(mongourl);
function a (){
//do something
}
});
how to trigger a()
in another async function?
server.on('clientConnected', function(client) {
//do a()
});
Make a()
a global function:
function a() {
// body
}
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var dbo = db.db(mongourl);
a()
});
server.on('clientConnected', function(client) {
a()
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.