private detail(modal,area){
    modal.open();

    Observable.timer(500).subscribe(()=>{
      area.focus();
      area.select();
    });
  }
 runPreIFrameTasks() {
     if (this._preIFrameTasks && this._preIFrameTasks.isUnsubscribed) {
         this._preIFrameTasks.unsubscribe();
     }
     this._preIFrameTasks = Observable.timer(0, 60000)
         .concatMap<string>(() => this._http.get('api/token?plaintext=true').retry(5).map<string>(r => r.text()))
         .subscribe(t => this._userService.setToken(t));
 }
Ejemplo n.º 3
0
 .debounce(doc => {
     if (doc.uri !== lastValidated && lastDurationSelector) {
         lastDurationSelector.next(0);
     }
     lastDurationSelector = new Rx.Subject<number>();
     Rx.Observable.timer(activeSettings.spellCheckDelayMs || defaultDebounce).subscribe(lastDurationSelector);
     return lastDurationSelector;
 })
Ejemplo n.º 4
0
  /**
   * Polls the server for the specified VDB.  Polling will terminate if
   * (1) The VDB is active
   * (2) The VDB is in a failed state
   * (3) The polling duration has lapsed
   * @param {string} vdbName the name of the VDB
   * @param {number} pollDurationSec the duration (sec) to poll the server
   * @param {number} pollIntervalSec the interval (sec) between polling attempts
   */
  public pollForActiveVdb(vdbName: string, pollDurationSec: number, pollIntervalSec: number): void {
    const pollIntervalMillis = pollIntervalSec * 1000;
    const pollIterations = pollDurationSec / pollIntervalSec;

    let pollCount = 0;
    const self = this;
    // start a timer after one second
    const timer = Observable.timer(1000, pollIntervalMillis);
    this.deploymentSubscription = timer.subscribe((t: any) => {
      this.getTeiidVdbStatuses()
        .subscribe(
          (resp) => {
            for ( const vdbStatus of resp ) {
              if ( vdbStatus.getName() !== vdbName ) {
                continue;
              }
              if ( vdbStatus.isActive() ) {
                this.notifierService.sendVdbDeploymentStatus(vdbStatus);
                self.deploymentSubscription.unsubscribe();
              } else if ( vdbStatus.isFailed() ) {
                this.notifierService.sendVdbDeploymentStatus(vdbStatus);
                self.deploymentSubscription.unsubscribe();
              }
            }
            pollCount++;
            if (pollCount > pollIterations) {
              // Timed out status
              const status: VdbStatus = new VdbStatus();
              status.setName(vdbName);
              status.setActive(false);
              status.setLoading(false);
              status.setFailed(true);
              const errors: string[] = [];
              errors.push("Deployment polling timed out");
              status.setErrors(errors);
              // broadcast the status
              this.notifierService.sendVdbDeploymentStatus(status);
              self.deploymentSubscription.unsubscribe();
            }
          },
          (error) => {
            // Error status
            const status: VdbStatus = new VdbStatus();
            status.setName(vdbName);
            status.setActive(false);
            status.setLoading(false);
            status.setFailed(true);
            const errors: string[] = [];
            errors.push("Deployment failed");
            status.setErrors(errors);
            // Broadcast the status
            this.notifierService.sendVdbDeploymentStatus(status);
            self.deploymentSubscription.unsubscribe();
          }
        );
    });
  }
Ejemplo n.º 5
0
 ngOnInit() {
   this.generateData();
   let timer = Observable.timer(5000, 2000);
   this.subscription = timer.subscribe(t => {
     if (!this.updateData()){
       this.subscription.unsubscribe();
     }
   });
 }
  ngOnInit() {
      this.breakLen = 10;
      this.sessionLen = 25;
      this.timeRemaining = this.sessionLen * 60;
      let timer = Observable.timer(0,1000);
      timer.subscribe(t => this.update());

      this.synth = new SynthSimple(new AudioContext());
      this.isSoundingAlarm = false;
  }
Ejemplo n.º 7
0
  /**
   * We have to poll the upload progress, because flow.js doesn't send events about it.
   *
   * Schedule a next view update after a second as long as flow.js has files.
   */
  scheduleViewUpdate(changeDetectorRef: ChangeDetectorRef, flow: any) {
    console.log("scheduling view update");
    Observable.timer(1000).subscribe(() => {
      // TODO check if view not destroyed
      changeDetectorRef.detectChanges();

      if (flow.files.length > 0) {
        this.scheduleViewUpdate(changeDetectorRef, flow);
      }
    });
  }
Ejemplo n.º 8
0
 getJson(url: string, update: number) {
   console.log(`reading ${ url }`);
   if (update !== -1) {
     return Observable.timer(0, update)
       .flatMap(() => this.http.get(url))
       .map(response => response.json());
   } else {
     return this.http.get(url)
       .map(response => response.json());
   }
 }
Ejemplo n.º 9
0
  public init(hour, minute) {
    this.normal = true;
    this.warning = false;
    this.alarm = false;
    this.currentTime = new Date();
    this.alarmTime = this.setAlarmTime(hour, minute);
    this.timer = Observable.timer(0,1000);

    let onTimerTick = this.timer.subscribe(x => {
      this.currentTime = new Date();
      this.checkAlarmTime();
    });
  }
Ejemplo n.º 10
0
 runClock(){
   if(this.host==true){
     let timer = Observable.timer(0,1000);
     this.timerSubscription = timer.subscribe(t=>{
       if(t <= this.gameClock.duration){
         this.gameClock.ticks = t;
         this.firebaseServer.update({Timer:this.gameClock.duration-this.gameClock.ticks});
       } else {
         this.stopClock();
       }
     })
   }
 }