• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript store.select函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@ngrx/store.select函数的典型用法代码示例。如果您正苦于以下问题:TypeScript select函数的具体用法?TypeScript select怎么用?TypeScript select使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了select函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: create

    async create(fileChanges: VcsFileChange[]): Promise<VcsItemCreateResult<NoteVcsItemComponent>> {
        const usedFileChanges: VcsFileChange[] = [];
        const refs: VcsItemRef<NoteVcsItemComponent>[] = [];

        // Get notes first.
        const notes = await toPromise(this.store.pipe(
            select(state => state.note.collection.notes),
            pipe(take(1)),
        ));

        for (const note of notes) {
            let index: number;
            const willUseFileChanges: VcsFileChange[] = [];

            // Note file
            index = fileChanges.findIndex(change => change.absoluteFilePath === note.filePath);
            if (index !== -1) {
                willUseFileChanges.push(fileChanges[index]);
            }

            // Note content file
            index = fileChanges.findIndex(change => change.absoluteFilePath === note.contentFilePath);
            if (index !== -1) {
                willUseFileChanges.push(fileChanges[index]);
            }

            if (willUseFileChanges.length > 0) {
                const config: VcsItemConfig = {
                    title: note.title,
                    fileChanges: willUseFileChanges,
                };

                const ref = new VcsItemRef<NoteVcsItemComponent>(config);
                ref.component = NoteVcsItemComponent;

                usedFileChanges.push(...willUseFileChanges);
                refs.push(ref);
            }
        }

        return { refs, usedFileChanges };
    }
开发者ID:suiruiw,项目名称:geeks-diary,代码行数:42,代码来源:note-vcs-item-factory.ts


示例2: hasSkilltree

 hasSkilltree(id: string): Observable<boolean> {
   return this.store.pipe(
     select(state => {
       return {loaded: Reducers.isLoaded(state), skilltrees: Reducers.getSkilltrees(state)};
     }),
     filter((combinedData) => {
       return combinedData.loaded;
     }),
     map(combinedData => {
       return combinedData.skilltrees;
     }),
     map(skilltrees => {
       return !!skilltrees[id];
     }),
     take(1),
     map(hasSkilltree => {
       return hasSkilltree;
     })
   );
 }
开发者ID:xXKeyleXx,项目名称:MyPet-SkilltreeCreator,代码行数:20,代码来源:skilltree-exists.guard.ts


示例3: ngOnInit

 ngOnInit() {
   this.store.dispatch(new GetAppImagesAction());
   this.app$ = this.store.pipe(select(getApp), filterNull());
   this._sub = this.app$.pipe(first()).subscribe(app => this.store.dispatch(new GetQrCodeTemplatesAction({
     appId: app.app_id,
     backendId: app.backend_server,
   })));
   this.imagesInfo$ = this.store.select(getAppImages);
   this.status$ = this.store.select(getAppImagesStatus);
   this.generateStatus$ = this.store.select(getGenerateAppImagesStatus);
   this.generateStatus$.subscribe(status => {
     if (status.success) {
       this.router.navigate([ '../' ], {
         relativeTo: this.route,
         queryParams: {
           reloadImage: true,
         },
       });
     }
   });
 }
开发者ID:our-city-app,项目名称:plugin-mobicage-control-center,代码行数:21,代码来源:generate-images.component.ts


示例4: it

    it('should initialize properly', () => {
      TestBed.configureTestingModule({
        imports: [
          StoreModule.forRoot(reducers, { initialState }),
          StoreModule.forFeature('items', todos, {
            initialState: featureInitialState,
          }),
        ],
      });

      const store: Store<any> = TestBed.get(Store);

      let expected = [
        {
          todos: initialState.todos,
          visibilityFilter: initialState.visibilityFilter,
          items: featureInitialState,
        },
      ];

      store.pipe(select(state => state)).subscribe(state => {
        expect(state).toEqual(expected.shift());
      });
    });
开发者ID:AlexChar,项目名称:platform,代码行数:24,代码来源:integration.spec.ts


示例5: constructor

 /**
  * Constructor
  *
  * @param {ChangeDetectorRef} _changeDetectorRef
  * @param {FuseSidebarService} _fuseSidebarService
  * @param {FuseTranslationLoaderService} _fuseTranslationLoaderService
  * @param {MailNgrxService} _mailNgrxService
  * @param {Store<MailAppState>} _store
  */
 constructor(
     private _changeDetectorRef: ChangeDetectorRef,
     private _fuseSidebarService: FuseSidebarService,
     private _fuseTranslationLoaderService: FuseTranslationLoaderService,
     private _mailNgrxService: MailNgrxService,
     private _store: Store<fromStore.MailAppState>
 )
 {
     // Set the defaults
     this.searchInput = new FormControl('');
     this._fuseTranslationLoaderService.loadTranslations(english, turkish);
     this.currentMail$ = this._store.pipe(select(fromStore.getCurrentMail));
     this.mails$ = this._store.pipe(select(fromStore.getMailsArr));
     this.folders$ = this._store.pipe(select(fromStore.getFoldersArr));
     this.labels$ = this._store.pipe(select(fromStore.getLabelsArr));
     this.selectedMailIds$ = this._store.pipe(select(fromStore.getSelectedMailIds));
     this.searchText$ = this._store.pipe(select(fromStore.getSearchText));
     this.mails = [];
     this.selectedMailIds = [];
 }
开发者ID:karthik12ui,项目名称:fuse-angular-full,代码行数:29,代码来源:mail.component.ts


示例6: resolve

	resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Item> {
		this.store.dispatch(new FindOneAction(route.params.id, route.params.podcastId));

		return this.store.pipe(select(item), skip(1), take(1));
	}
开发者ID:davinkevin,项目名称:Podcast-Server,代码行数:5,代码来源:item.resolver.ts


示例7: ngOnInit

 ngOnInit() {
   this.chartDetails$ = this.store.pipe(select(selectAppDetails));
 }
开发者ID:supergiant,项目名称:supergiant,代码行数:3,代码来源:app-details.component.ts


示例8: constructor

 constructor(private store: Store<fromBooks.State>) {
   this.book$ = store.pipe(select(fromBooks.getSelectedBook));
   this.isSelectedBookInCollection$ = store.pipe(
     select(fromBooks.isSelectedBookInCollection)
   );
 }
开发者ID:WinGood,项目名称:platform,代码行数:6,代码来源:selected-book-page.ts


示例9: getLinkTypes

 get getLinkTypes(): Observable<LinkTypeUI[]> {
   return this.store.pipe(
     select(workItemDetailSelector),
     select(state => state.linkType),
     filter(lt => !!lt.length));
 }
开发者ID:joshuawilson,项目名称:almighty-ui,代码行数:6,代码来源:link-type.ts


示例10: constructor

 constructor(private store: Store<fromRoot.State>) {
     this.article$ = store.pipe(select(fromArticles.getSelectedArticle));
 }
开发者ID:evcraddock,项目名称:erikvancraddock.com,代码行数:3,代码来源:article-detail.component.ts



注:本文中的@ngrx/store.select函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript store.usePostMiddleware函数代码示例发布时间:2022-05-28
下一篇:
TypeScript store.provideStore函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap