當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript store.Action函數代碼示例

本文整理匯總了TypeScript中@ngxs/store.Action函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript Action函數的具體用法?TypeScript Action怎麽用?TypeScript Action使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Action函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: updateState

 @Action(UpdateAppStateAction)
 updateState({ patchState }: StateContext<AppStateModel>, action: UpdateAppStateAction) {
   patchState(action.payload);
 }
開發者ID:berta-cms,項目名稱:berta,代碼行數:4,代碼來源:app.state.ts

示例2: resetProducts

 @Action(ResetShopSettingsAction)
 resetProducts({ setState }: StateContext<ShopSettingsModel>) {
   setState(defaultState);
 }
開發者ID:berta-cms,項目名稱:berta,代碼行數:4,代碼來源:shop-settings.state.ts

示例3: loadData

 @Action(LoadData)
 public loadData({ patchState }: StateContext<TodoStateModel>) {
   const data = { toppings: 'pineapple', crust: 'medium', extras: [false, false, true] };
   return of(data).pipe(tap(values => patchState({ pizza: { model: { ...values } } })));
 }
開發者ID:LucasFrecia,項目名稱:store,代碼行數:5,代碼來源:todos.state.ts

示例4: addSectionEntries

 @Action(AddSectionEntriesAction)
 addSectionEntries({ patchState, getState }: StateContext<SectionEntriesStateModel>, action: AddSectionEntriesAction) {
   const state = getState();
   patchState({[action.siteName]: [...state[action.siteName], ...action.entries]});
 }
開發者ID:berta-cms,項目名稱:berta,代碼行數:5,代碼來源:section-entries.state.ts

示例5: resetSectionEntries

 @Action(ResetSectionEntriesAction)
 resetSectionEntries({ setState }: StateContext<SectionEntriesStateModel>) {
   setState({});
 }
開發者ID:berta-cms,項目名稱:berta,代碼行數:4,代碼來源:section-entries.state.ts

示例6: initializeShop

 @Action(InitShopAction)
 initializeShop({ setState }: StateContext<ShopModel>, action: InitShopAction) {
   setState(action.payload);
 }
開發者ID:berta-cms,項目名稱:berta,代碼行數:4,代碼來源:shop.state.ts

示例7: imagesLoaded

 @Action(ImagesLoaded)
 imagesLoaded({ patchState }: StateContext<ExplorerImageStateModel>, action: ImagesLoaded) {
     patchState({
         images: action.images
     });
 }
開發者ID:pschild,項目名稱:image-management-tool,代碼行數:6,代碼來源:explorer-image.state.ts

示例8: resetSiteTemplates

 @Action(ResetSiteTemplatesAction)
 resetSiteTemplates({ setState }: StateContext<SiteTemplatesStateModel>) {
   setState({});
 }
開發者ID:berta-cms,項目名稱:berta,代碼行數:4,代碼來源:site-templates.state.ts

示例9: addTodo

 @Action(AddTodo)
 public addTodo({ getState, setState }: StateContext<Todo[]>, { payload }: AddTodo) {
   setState(state => [...state, payload]);
 }
開發者ID:LucasFrecia,項目名稱:store,代碼行數:4,代碼來源:todo.state.ts

示例10: navigateBack

 @Action(NavigateBack)
 navigateBack({ getState, dispatch }: StateContext<ExplorerStateModel>) {
     const state = getState();
     state.currentPath.pop();
     dispatch(new LoadContentByPath(state.currentPath));
 }
開發者ID:pschild,項目名稱:image-management-tool,代碼行數:6,代碼來源:explorer.state.ts


注:本文中的@ngxs/store.Action函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。