當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ReplaySubject.asObservable方法代碼示例

本文整理匯總了TypeScript中rxjs/ReplaySubject.ReplaySubject.asObservable方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ReplaySubject.asObservable方法的具體用法?TypeScript ReplaySubject.asObservable怎麽用?TypeScript ReplaySubject.asObservable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rxjs/ReplaySubject.ReplaySubject的用法示例。


在下文中一共展示了ReplaySubject.asObservable方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

    /**
     * Creates an instance of Camera.
     * 
     * @param {HTMLCanvasElement} mCanvas
     */
    constructor(private mCanvas: HTMLCanvasElement) {
        super();
        this.mSizeChanged$ = new ReplaySubject<IBounds>(1);

        this.mOnSizeChanged = this.mSizeChanged$.asObservable().debounceTime(200);
        this.refreshProjection();
    }
開發者ID:MehdiZonjy,項目名稱:book-viewer,代碼行數:12,代碼來源:camera.ts

示例2: MemorySource

export function MemorySource(map: MemoryMap) {
  const subject = new ReplaySubject();
  try {
    _recursiveMemorySource(subject, map, '');
    subject.complete();
  } catch (err) {
    subject.error(err);
  }
  return subject.asObservable();
}
開發者ID:hansl,項目名稱:schematics,代碼行數:10,代碼來源:source.ts

示例3: _updateUserProgramInCache

    private async _updateUserProgramInCache(program: UserFacingProgram, resp: any): Promise<boolean> {
        if (resp.result === 'updated' || resp.result === 'created') {
            const cache = await this._cache.asObservable().take(1).toPromise();
            const val = cache.find(p => p.guid === program.guid);

            if (val) {
                val.user = program;
                this._cache.next(cache);
            } else {
                this._cache.next([{guid: program.guid, application: [], user: program},  ...cache]);
            }
            return true;
        }
        return false;
    }
開發者ID:yeg-relief,項目名稱:screenerClient,代碼行數:15,代碼來源:program-model.service.ts

示例4: _recursiveFileSource

function _recursiveFileSource(p: string, root: string): Observable<Entry> {
  const subject = new ReplaySubject();

  access(p, fs.R_OK)
    .then(() => stat(p))
    .catch(err => { throw new FileSystemException(err); })
    .then((stats) => {
      if (stats.isFile()) {
        if (p == root) {
          // Root is a file. Error.
          throw new SourceRootMustBeDirectoryException();
        }
        return readFile(p, 'utf-8')
          .then((data) => {
            const subpath = path.relative(root, p);
            subject.next(new StaticEntry(path.dirname(subpath), path.basename(subpath), data));
          });
      } else {
        return readdir(p)
          .then((files) => {
            return Promise.all(files.map((file) => {
              return _recursiveFileSource(path.join(p, file), root)
                .forEach((value) => {
                  if (value) {
                    subject.next(value);
                  }
                });
            }));
          });
      }
    })
    .then(() => subject.complete())
    .catch((err) => subject.error(err));

  return subject.asObservable();
}
開發者ID:hansl,項目名稱:schematics,代碼行數:36,代碼來源:source.ts

示例5:

 return input$.flatMap(data => Observable.zip(Observable.of(data), this._cache.asObservable()))
開發者ID:yeg-relief,項目名稱:screenerClient,代碼行數:1,代碼來源:program-model.service.ts

示例6: getPrograms

 getPrograms(): Observable<ApplicationFacingProgram[]> {
     return this._cache.asObservable();
 }
開發者ID:yeg-relief,項目名稱:screenerClient,代碼行數:3,代碼來源:program-model.service.ts

示例7: findProgram

 findProgram(guid: string): Observable<Program> {
     return this._cache.asObservable()
         .map(programs => programs.find(this._findProgram(guid)))
         .map(p => p !== undefined ? new Program(p, this.fb) : null)
         .map(p => p === null ? new Program(undefined, this.fb) : p)
 }
開發者ID:yeg-relief,項目名稱:screenerClient,代碼行數:6,代碼來源:program-model.service.ts


注:本文中的rxjs/ReplaySubject.ReplaySubject.asObservable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。