标题:events模块 多个 同一sql 语句一次调用 |
发帖时间:2018-05-24 09:05:05 |
乌托
var proxy = new events.EventEmitter();
var status = "ready";
var select = function(callback){
proxy.once("selected",callback);
if(status ==="ready"){
status = "pending";
db.select("sql",function(results){
proxy.emit("slected",results);
status = "ready";
})
}
}