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