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));
 }
Example #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;
 })
Example #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();
          }
        );
    });
  }
 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;
  }
Example #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);
      }
    });
  }
Example #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());
   }
 }
  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();
    });
  }
 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();
       }
     })
   }
 }
 constructor(public router: Router, public http: Http, public authHttp: AuthHttp) {
   let timer = Observable.timer(2000, 1000);
   let jwtHelper: JwtHelper = new JwtHelper();
   timer.subscribe(t => {
     var token = jwtHelper.decodeToken(localStorage.getItem('id_token'));
     if (token) {
       this.tokenExpires = ((token.exp * 1000) - Number(new Date()));
       this.tokenExpired = this.tokenExpires <= 0;
       if (this.tokenExpires > -5000 && this.tokenExpires < 2000) {
         this.refreshToken();
       }
     }
   });
 }
 .subscribe(limitCheckResult => {
   if (limitCheckResult) {
     const request = serviceClient
       .createRequestResponseOperation(
         'executeTrade',
         executeTradeRequest
       )
       .publish()
       .refCount()
     disposables.add(
       Observable.merge(
         request
           .map(dto => {
             const trade = tradeMapper.mapFromTradeDto(dto.Trade)
             log.info(
               `execute response received for: ${executeTradeRequest}. Status: ${trade.status}`,
               dto
             )
             return createExecuteTradeResponse(trade)
           })
           // if we never receive a response, mark request as complete
           .timeout(
             EXECUTION_REQUEST_TIMEOUT_MS,
             Scheduler.asap.schedule(() =>
               createExecuteTradeResponseForError(
                 'Trade execution timeout exceeded',
                 executeTradeRequest
               )
             )
           ),
         // show timeout error if request is taking longer than expected
         Observable.timer(EXECUTION_CLIENT_TIMEOUT_MS)
           .map(() =>
             createExecuteTradeResponseForError(
               'Trade execution timeout exceeded',
               executeTradeRequest
             )
           )
           .takeUntil(request)
       ).subscribe(o)
     )
   } else {
     o.next(
       createExecuteTradeResponseForError(
         'Credit limit exceeded',
         executeTradeRequest
       )
     )
   }
 })
 runTasks() {
     if (this._tasks && this._tasks.isUnsubscribed) {
         this._tasks.unsubscribe();
     }
     this._tasks = Observable.timer(1, 60000)
     .concatMap<{errors: string[], config: {[key: string]: string}, appSettings: {[key: string]: string} }>(() =>
         Observable.zip(
             this._functionsService.getHostErrors().catch(e => Observable.of([])),
             this._armService.getConfig(this._globalStateService.FunctionContainer),
             this._armService.getFunctionContainerAppSettings(this._globalStateService.FunctionContainer),
             (e,  c, a) => ({errors: e, config: c, appSettings: a})
         )
     )
     .subscribe(result => {
         result.errors.forEach(e => this._broadcastService.broadcast<ErrorEvent>(BroadcastEvent.Error, { message: e, details: `Host Error: ${e}` }));
         this.setDisabled(result.config);
         this._functionsService.setEasyAuth(result.config);
         this._globalStateService.AppSettings = result.appSettings;
         this._broadcastService.broadcast(BroadcastEvent.VersionUpdated);
     });
 }
Example #14
0
    static start() {
       console.log(" !!!!!!!!!!!!!!!!!! SQLiteHandle.recordTotalSize a = " + SQLiteHandle.recordTotalSize);

        let timer = Observable.timer(500, 500);
        SQLiteState.subscription = timer.subscribe(this.func);
    }
Example #15
0
				.debounce(ev => Observable.timer(throttle))
 observable1 = constructorZone1.run(() => {
   const source = Rx.Observable.timer(0, 10).take(6);
   const window = source.window(Rx.Observable.interval(30));
   return window.mergeAll();
 });
 ngOnInit(){
     let timer = Observable.timer(1000,3000);
     timer.subscribe(any => {
         this.getJoke();
     });
 }
 createTimer(dueTime: number, period: number) {
     this.timer = Observable.timer(dueTime, period);
 }
Example #19
0
 observable1 = constructorZone1.run(() => {
   return Rx.Observable.timer(10, 20);
 });
Example #20
0
 ngOnInit(){
     let clock = Observable.timer(2000,1000);
     clock.subscribe(t => this.timer(t));
 }
 observable1 = constructorZone1.run(() => {
   return Rx.Observable.timer(0, 10).take(10);
 });
 observable1 = constructorZone1.run(() => {
   const source = Rx.Observable.timer(0, 10).take(10);
   const window = source.windowCount(4);
   return window.mergeAll();
 });
 return Rx.Observable.of(1, 2, 3).delayWhen((v: any) => {
   return Rx.Observable.timer(v * 10);
 });
 getData():any {
     return Observable.timer(0, 3000)
         .flatMap(() => {
             return this.customHttp.get('/admin/notifications')
         });
 }
 return Rx.Observable.of(1, 2, 3).debounce(() => {
   expect(Zone.current.name).toEqual(constructorZone1.name);
   return Rx.Observable.timer(100);
 });
Example #26
0
 private subscribeToDeployCheck(): void {    
   this.timerSubscription = Observable.timer(1000)
     .subscribe(() => this.startDeployChecker());
  }
 .flatMap( (i) => {
     console.log("Unable to fetch...delay retry by " + i + " second(s)")
     return Observable.timer(i * 1000);
 })
 ngOnInit(){
   Observable.timer(5000,5000).subscribe(() => {
     console.log(`Refreshing ${this.stock.ticker}`);
     this.stockService.get(this.stock.ticker).then(stock => Object.assign(this.stock, stock));
   });
 }
 ngOnInit() {
   this.itemObservable = Observable.timer(100, 100).take(101);
 }
 private subscribeToData(): void {
     this.timerSubscription = Observable.timer(50)
         .subscribe(() => this.checkdeploy());
 }