当前位置: 首页>>代码示例>>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;未经允许,请勿转载。