From fe00c84f3aa9a4e22ec41dc65ee7abeb129ea9a7 Mon Sep 17 00:00:00 2001 From: river <382599512@qq.com> Date: Tue, 24 Dec 2019 23:36:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=BC=82=E6=AD=A5?= =?UTF-8?q?=E6=89=A7=E8=A1=8Cready=E7=9A=84=E4=BA=8B=E4=BB=B6=E7=9B=91?= =?UTF-8?q?=E5=90=AC=E7=9A=84callback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 异步执行ready的事件监听的callback,防止在其他事件监听还没有加载完毕就提前执行 Issue #159 --- src/observer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/observer.js b/src/observer.js index b64f7d0..27b9c0a 100644 --- a/src/observer.js +++ b/src/observer.js @@ -14,7 +14,7 @@ export default function observer () { if (EVENT_TYPE.indexOf(event) > -1) { if (isFunc(fn)) { event === 'ready' - ? fn(self) + ? Promise.resolve().then(() => { fn(self) }) : self[`on${firstLetterUpper(event)}`] = fn } } else {