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


TypeScript ReplaySubject.ReplaySubject类代码示例

本文整理汇总了TypeScript中rxjs/ReplaySubject.ReplaySubject的典型用法代码示例。如果您正苦于以下问题:TypeScript ReplaySubject类的具体用法?TypeScript ReplaySubject怎么用?TypeScript ReplaySubject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: inject

 inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
   let responses: Response[] = [sampleResponse1, sampleResponse2];
   backend.connections.subscribe((c: MockConnection) => c.mockRespond(responses.shift()));
   let responseObservable: ReplaySubject<Response> =
       backend.createConnection(sampleRequest1).response;
   responseObservable.subscribe(res => expect(res.text()).toBe('response1'));
   responseObservable.subscribe(res => expect(res.text()).toBe('response2'), null,
                                async.done);
 }));
开发者ID:0xJoKe,项目名称:angular,代码行数:9,代码来源:mock_backend_spec.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: it

  it('Should notify errorneous execution', async () => {
    const error = new Error('');
    const observable = new ReplaySubject<Error | undefined>();
    observable.next(error);

    const notificationService = NotificationService.getInstance();
    await notificationService.reportExecutionError('mock command', observable);

    assert.calledOnce(mShow);
    assert.notCalled(mShowInformation);
    assert.notCalled(mShowWarningMessage);
    assert.calledWith(mShowErrorMessage, 'mock command failed to run');
  });
开发者ID:nertofiveone,项目名称:salesforcedx-vscode,代码行数:13,代码来源:index.test.ts

示例4: 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

示例5: tabCreated

  public tabCreated(tab: ITab) {
    this.tabDictionary.setValue(tab.key, tab);
    this.tabAdded.next(tab);

    if (!this.active || tab.instantOpen) {
      this.tabActivated.next(tab);
    }
  }
开发者ID:carathorys,项目名称:angular2-chat,代码行数:8,代码来源:tab-service.ts

示例6: _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

示例7: remove

 public remove(key: string): void {
   this.tabDictionary.remove(key);
   this.tabRemoved.next(key);
   if (this.active == key) {
     this.activate(this.tabDictionary.keys[0]);
   }
 }
开发者ID:carathorys,项目名称:angular2-chat,代码行数:7,代码来源:tab-service.ts

示例8:

            .do( ([data, cache]) => {
                let index = cache.findIndex(this._findProgram(data.guid));

                if (index >= 0)
                    cache[index] = data;

                this._cache.next(cache);
            })
开发者ID:yeg-relief,项目名称:screenerClient,代码行数:8,代码来源:program-model.service.ts


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