当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Observable.first方法代码示例

本文整理汇总了TypeScript中rxjs.Observable.first方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Observable.first方法的具体用法?TypeScript Observable.first怎么用?TypeScript Observable.first使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rxjs.Observable的用法示例。


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

示例1: getWatchHandlers

function getWatchHandlers(
  buildOutput$: Observable<string>,
  {
    handlerDelay = defaultHandlerDelay,
    handlerReadinessTimeout = defaultHandlerReadinessTimeout,
  }: IWatchOptions
) {
  const typescriptHandler = buildOutput$
    .first(data => data.includes('$ tsc'))
    .map(() =>
      buildOutput$
        .first(data => data.includes('Compilation complete.'))
        .mapTo('tsc')
    );

  const webpackHandler = buildOutput$
    .first(data => data.includes('$ webpack'))
    .map(() =>
      buildOutput$.first(data => data.includes('Chunk Names')).mapTo('webpack')
    );

  const defaultHandler = Observable.of(undefined)
    .delay(handlerReadinessTimeout)
    .map(() =>
      buildOutput$.timeout(handlerDelay).catch(() => Observable.of('timeout'))
    );

  return [typescriptHandler, webpackHandler, defaultHandler];
}
开发者ID:JinlongHe,项目名称:kibana,代码行数:29,代码来源:watch.ts

示例2: return

	    return (control: FormControl) => {
				return names$.first()
					.map(res => R.map((n: string) => (n) ? n.toLowerCase() : n)(res))
					.map(res => R.contains(control.value.toLowerCase())(res))
					.map(res => (res) ? ({ 'duplicated': true }) : null)
					.toPromise();
			}
开发者ID:simbiosis-group,项目名称:ion2-claim,代码行数:7,代码来源:extra-validators.ts

示例3: constructor

  constructor(
    public platform: Platform,
    private _config: Config,
    private _translateService: TranslateService,
    private _splashScreen: SplashScreen,
    private _statusBar: StatusBar,
    private _iab: InAppBrowser,
    private _store: Store<fromRoot.State>
  ) {
    this._translateService.setDefaultLang("no_nb");
    this._translateService.use("no_nb");
    moment.locale("nb");

    this.platform.ready().then(() => {
      this._statusBar.styleDefault();
      this._translateService.get("BACK").subscribe((res: string) => {
        this._config.set("ios", "backButtonText", res);
      });
    });

    this.sections$ = this._store.select(fromRoot.getSections);
    this.selectedSection$ = this._store
      .select(fromRoot.getSelectedSection)
      .filter(section => !!section);

    this.selectedSection$.first().subscribe(section => {
      this.rootPage = OverviewPage;
      this._splashScreen.hide();
    });

    this.externalLinks$ = this._translateService.get("MENU.EXTERNAL.ITEMS");
    this.contactLinks$ = this._translateService.get("MENU.CONTACT_INFO.ITEMS");
    this.logoLinks$ = this._translateService
      .get("LOGOS")
      .map((res: { [key: string]: { HEADER: string; LIST: string[] } }) => {
        return Object.keys(res).reduce((logos, key) => {
          logos.push({
            header: res[key].HEADER,
            list: res[key].LIST
          });
          return logos;
        }, []);
      });
  }
开发者ID:bGraphic,项目名称:varsom-hybrid,代码行数:44,代码来源:app.component.ts

示例4:

 .map(() =>
   buildOutput$.first(data => data.includes('Chunk Names')).mapTo('webpack')
开发者ID:JinlongHe,项目名称:kibana,代码行数:2,代码来源:watch.ts


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