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