日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ngrx Effect学习笔记

發布時間:2023/12/19 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ngrx Effect学习笔记 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

SAP Spartacus的connector通過NgRx的Effect從SAP Commerce Cloud后臺取數據。

官網地址:https://ngrx.io/guide/effects

Effects的五大要點

Effects are injectable service classes with distinct parts:

(1) An injectable Actions service that provides an observable stream of all actions dispatched after the latest state has been reduced.

監聽currency和language change:

每個injectable Effects都有一個action service actions$,在store最新的狀態被reduce之后,能夠dispatch一個observable stream.

(2) Metadata is attached to the observable streams using the createEffect function. The metadata is used to register the streams that are subscribed to the store. Any action returned from the effect stream is then dispatched back to the Store.

使用createEffect將Metadata添加到observable streams上去。Metadata的作用是將streams注冊到store上去。從Effect stream返回的action會重新dispatch到store中去。

(3) Actions are filtered using a pipeable ofType operator. The ofType operator takes one or more action types as arguments to filter on which actions to act upon.

Actions通過ofType操作符進行過濾。ofType操作符接受一個或多個Action type作為輸入參數,過濾某個effect應該響應哪一個action.

(4) Effects are subscribed to the Store observable.

Effects訂閱到store Observable上面。

(5) Services are injected into effects to interact with external APIs and handle streams.

服務注冊到effects里,同外部API交互。

關于Observable真正開始工作的時間點

官網提到:

This means that calling subscribe is actually the moment when Observable starts its work, not when it is created

調用Observable的subscribe方法,才是Observable真正開始工作的時間點,而不是它被創建的時候。

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的ngrx Effect学习笔记的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。