Node EventEmitter事件队列
文章目录
var proxy = new events.EventEmitter()
var status = "ready"
var select = function(callback) {
proxy.once("selected", callback)
if (status === "ready") {
status = "pending"
setTimeout(() => {
proxy.emit("selected", results)
status = "ready"
}, 2000)
}
}
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论