摘要: js引擎有一个叫monitoring process,它用来检测主线程栈是否为空,不为空时,主线程任务依次执行,否则,将从Event table中拿到event queue 1.微任务在前,宏任务在后,并且队列也以顺序区分 2.微任务有:process.nexttick以及promise中的then 阅读全文
posted @ 2021-01-11 18:51 灏月天染 阅读(81) 评论(0) 推荐(0) 编辑
摘要: function Observer(){this.fns = []} Observer.prototype = { subscribe:function(fn){ this.fns.push(fn) }, unsubscribe:function(fn){ this.fns = this.fns.f 阅读全文
posted @ 2021-01-11 18:23 灏月天染 阅读(156) 评论(0) 推荐(0) 编辑