Angular的Zone-Evergreen在SAP Spartacus中的应用

zone-evergreen.js

触发产品数据的加载:

Angular的Zone-Evergreen在SAP Spartacus中的应用

url:https://spartacus-dev0.eastus.cloudapp.azure.com:9002/occ/v2/electronics-spa/products/300938?fields=code,name,summary,price(formattedValue),images(DEFAULT,galleryIndex)&lang=zh&curr=USD

Angular的Zone-Evergreen在SAP Spartacus中的应用

Zone是一个执行上下文,能够在多个异步任务之间持久化。可以将其类比成为JavaScript VM设计的thread-local storage.
A Zone is an execution context that persists across async tasks. You can think of it as thread-local storage for JavaScript VMs.

So, without zones, we don’t get any change detection, so we don’t get any of the nice UI updates that we’d expect!

没有zone-evergreen就没有change detection.

Angular的Zone-Evergreen在SAP Spartacus中的应用

更多Jerry的原创文章,尽在:“汪子熙”:
Angular的Zone-Evergreen在SAP Spartacus中的应用