當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。