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


TypeScript Observable.timer方法代码示例

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


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

示例1: detail

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

    Observable.timer(500).subscribe(()=>{
      area.focus();
      area.select();
    });
  }
开发者ID:ringtail003,项目名称:oreno-issue,代码行数:8,代码来源:issue-title.component.ts

示例2: runPreIFrameTasks

 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));
 }
开发者ID:rumnha,项目名称:AzureFunctionsPortal,代码行数:8,代码来源:background-tasks.service.ts

示例3:

 .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;
 })
开发者ID:AlekSi,项目名称:vscode-spell-checker,代码行数:8,代码来源:server.ts

示例4: pollForActiveVdb

  /**
   * 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();
          }
        );
    });
  }
开发者ID:tejones,项目名称:beetle-studio,代码行数:66,代码来源:vdb.service.ts

示例5: ngOnInit

 ngOnInit() {
   this.generateData();
   let timer = Observable.timer(5000, 2000);
   this.subscription = timer.subscribe(t => {
     if (!this.updateData()){
       this.subscription.unsubscribe();
     }
   });
 }
开发者ID:gersonnoboa,项目名称:BackInBlack,代码行数:9,代码来源:task1.component.ts

示例6: ngOnInit

  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;
  }
开发者ID:nbogie,项目名称:fcc-pomodoro-angular2,代码行数:10,代码来源:timer.component.ts

示例7: scheduleViewUpdate

  /**
   * 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);
      }
    });
  }
开发者ID:chipster,项目名称:chipster-web,代码行数:16,代码来源:upload.service.ts

示例8: getJson

 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());
   }
 }
开发者ID:davidanaya,项目名称:angular2-info,代码行数:11,代码来源:data.service.ts

示例9: init

  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();
    });
  }
开发者ID:d-nation,项目名称:parenting-utils,代码行数:13,代码来源:alarm.service.ts

示例10: runClock

 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();
       }
     })
   }
 }
开发者ID:JacobDeming,项目名称:HotfixEngine,代码行数:13,代码来源:timer.component.ts


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