当前位置: 首页>>代码示例>>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;未经允许,请勿转载。