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

    if (!this.active || tab.instantOpen) {
      this.tabActivated.next(tab);
    }
  }
Example #2
0
 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);
 }));
Example #3
0
export function MemorySource(map: MemoryMap) {
  const subject = new ReplaySubject();
  try {
    _recursiveMemorySource(subject, map, '');
    subject.complete();
  } catch (err) {
    subject.error(err);
  }
  return subject.asObservable();
}
  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');
  });
  it('Should notify unsuccessful execution', async () => {
    const ABNORMAL_EXIT = -1;
    const observable = new ReplaySubject<number | undefined>();
    observable.next(ABNORMAL_EXIT);

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

    assert.calledOnce(mShow);
    assert.notCalled(mShowInformation);
    assert.notCalled(mShowWarningMessage);
    assert.calledWith(mShowErrorMessage, 'mock command failed to run');
  });
    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;
    }
Example #7
0
 public remove(key: string): void {
   this.tabDictionary.remove(key);
   this.tabRemoved.next(key);
   if (this.active == key) {
     this.activate(this.tabDictionary.keys[0]);
   }
 }
  it('Should notify successful execution', async () => {
    const observable = new ReplaySubject<number | undefined>();
    observable.next(0);

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

    assert.notCalled(mShow);
    assert.calledWith(
      mShowInformation,
      'mock command successfully ran',
      SHOW_BUTTON_TEXT
    );
    assert.notCalled(mShowWarningMessage);
    assert.notCalled(mShowErrorMessage);
  });
Example #9
0
    /**
     * 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();
    }
            .do( ([data, cache]) => {
                let index = cache.findIndex(this._findProgram(data.guid));

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

                this._cache.next(cache);
            })