fixture.detectChange如何通过Angular zone执行其异步逻辑的
生活随笔
收集整理的這篇文章主要介紹了
fixture.detectChange如何通过Angular zone执行其异步逻辑的
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
調(diào)試出發(fā)點(diǎn):
在detectChange內(nèi)部本身有一個(gè)ngZone:
接下來會在this.ngZone里執(zhí)行箭頭函數(shù)的邏輯,即this._tick():
this.ngZone.run里面調(diào)用_inner的run方法:
this._zoneDelegate.invoke:
ZoneDelegate.invoke方法內(nèi)部, 調(diào)用this._invokeZS.onInvoke:
onInvoke:首先onEnter進(jìn)入Zone:
onEnter方法,修改zone._nesting的層數(shù):
parentZoneDelegate.invoke: 調(diào)用callback,Angular單元測試代碼里調(diào)用fixture.detectChanges, 內(nèi)部放入zone執(zhí)行的this._tick():
更多Jerry的原創(chuàng)文章,盡在:“汪子熙”:
總結(jié)
以上是生活随笔為你收集整理的fixture.detectChange如何通过Angular zone执行其异步逻辑的的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: hdcp功能是什么(hdmi中cec)
- 下一篇: fixture.detectChange