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


TypeScript Observable.default方法代码示例

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


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

示例1: buildURL

    ({ owner, repoName, mergeRequestID, diffID }: GetBaseCommitIDInput) => {
        const mrURL = buildURL(owner, repoName, `/merge_requests/${mergeRequestID}`)

        // If we have a `diffID`, retrieve the information for that individual diff.
        if (diffID) {
            return get<DiffVersionsResponse>(`${mrURL}/versions/${diffID}`).pipe(
                map(({ base_commit_sha }) => base_commit_sha)
            )
        }

        // Otherwise, just get the overall base `commitID` for the merge request.
        return get<MergeRequestResponse>(mrURL).pipe(map(({ diff_refs: { base_sha } }) => base_sha))
    },
开发者ID:JoYiRis,项目名称:sourcegraph,代码行数:13,代码来源:api.ts

示例2: user

export const bid = (af: AngularFire) => (jobId: string): Observable<Bid> =>
    user(af)
        .filter(id)
        .flatMap(u => af.database.object(`bids/${jobId}/${u.$key}`, { preserveSnapshot: true }))
        .skipWhile(s => s.val() == null)
        .map(s => assign(s.val(), {$key: s.key}))
        .onErrorResumeNext(null);
开发者ID:matantsu,项目名称:GetPro,代码行数:7,代码来源:selectors.ts

示例3: getStartCommand

export const installShellCommand = () => {
  const directories = getStartCommand();
  if (!directories) {
    dialog.showErrorBox(
      "nteract application not found.",
      "Could not locate nteract executable."
    );
    return;
  }

  const [exe, rootDir, binDir] = directories;

  const obs = installShellCommandsObservable(exe, rootDir, binDir);
  obs.subscribe(
    () => {},
    err => dialog.showErrorBox("Could not write shell script.", err.message),
    () =>
      dialog.showMessageBox({
        title: "Command installed.",
        message: 'The shell command "nteract" is installed.',
        detail: 'Get help with "nteract --help".',
        buttons: ["OK"]
      })
  );
};
开发者ID:nteract,项目名称:nteract,代码行数:25,代码来源:cli.ts

示例4: user

export const jobs$ = (af: AngularFire): Observable<Job[]> =>
    user(af)
        .filter(id)
        .flatMap(u => af.database.object(`owner_to_jobs/${u.$key}`, { preserveSnapshot: true}))
        .filter(s => s.val())
        .map(s => s.val())
        .map(x => Object.keys(x))
        .map(l => l.map(fillJob(af)))
        .flatMap(os => Observable.combineLatest(...os.map(o => o.startWith(null)), list))
        .map(l => l.filter(id))
        .startWith([])
        .map(j => j.sort((a, b) => b.timestamp - a.timestamp));
开发者ID:matantsu,项目名称:GetPro,代码行数:12,代码来源:selectors.ts

示例5: recursiveList

  list(path: string): Promise<string[]> {
    const recursiveList = (path: Path): Observable<Path> => this._host.list(path).pipe(
      // Emit each fragment individually.
      concatMap(fragments => from(fragments)),
      // Join the path with fragment.
      map(fragment => join(path, fragment)),
      // Emit directory content paths instead of the directory path.
      mergeMap(path => this._host.isDirectory(path).pipe(
          concatMap(isDir => isDir ? recursiveList(path) : of(path))
        )
      ),
    );

    return recursiveList(this._resolve(path)).pipe(
      map(path => path.replace(this.base, '')),
      toArray(),
    ).toPromise().then(x => x, _err => []);
  }
开发者ID:fmalcher,项目名称:angular-cli,代码行数:18,代码来源:index.ts

示例6: observableOf

      mergeMap((hasLoadedSession) : Observable<ICreateSessionEvent> => {
        if (!hasLoadedSession) {
          log.warn("EME: No data stored for the loaded session");
          sessionStorage.delete(initData, initDataType);
          return observableOf({
            type: "created-session" as "created-session",
            value: { mediaKeySession: session, sessionType },
          });
        }

        if (hasLoadedSession && isSessionUsable(session)) {
          sessionStorage.add(initData, initDataType, session);
          log.info("EME: Succeeded to load persistent session.");
          return observableOf({
            type: "loaded-persistent-session" as "loaded-persistent-session",
            value: { mediaKeySession: session, sessionType },
          });
        }

        // Unusable persistent session: recreate a new session from scratch.
        log.warn("EME: Previous persistent session not usable anymore.");
        return recreatePersistentSession();
      }),
开发者ID:canalplus,项目名称:rx-player,代码行数:23,代码来源:create_session.ts

示例7: concatMap

 concatMap(isDir => isDir ? recursiveList(path) : of(path))
开发者ID:fmalcher,项目名称:angular-cli,代码行数:1,代码来源:index.ts

示例8: memoizeObservable

) => Observable<string> = memoizeObservable(({ owner, repoName, commitID }) =>
    get<CommitResponse>(buildURL(owner, repoName, `/repository/commits/${commitID}`)).pipe(
        map(({ parent_ids }) => first(parent_ids)!) // ! because it'll always have a parent if we are looking at the commit page.
    )
开发者ID:JoYiRis,项目名称:sourcegraph,代码行数:4,代码来源:api.ts

示例9: map

 ({ project, repoName, commitID }) =>
     get<CommitResponse>(buildURL(project, repoName, `/commits/${commitID}`)).pipe(
         map(({ parents }) => first(parents)),
         filter(isDefined),
         map(({ id }) => id)
     )
开发者ID:JoYiRis,项目名称:sourcegraph,代码行数:6,代码来源:api.ts


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