當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Subscription.unsubscribe方法代碼示例

本文整理匯總了TypeScript中rxjs/Rx.Subscription.unsubscribe方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Subscription.unsubscribe方法的具體用法?TypeScript Subscription.unsubscribe怎麽用?TypeScript Subscription.unsubscribe使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rxjs/Rx.Subscription的用法示例。


在下文中一共展示了Subscription.unsubscribe方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

 this.taskListService.getUserLists().subscribe((taskListsObservable) => {
   if (this.taskListsSubscription != null) {
     this.taskListsSubscription.unsubscribe();
   }
   this.taskListsSubscription =
       taskListsObservable.subscribe((taskLists) => { this.taskLists = taskLists; });
 });
開發者ID:hanaum,項目名稱:choose_to_go,代碼行數:7,代碼來源:userListView.component.ts

示例2: ngOnDestroy

 ngOnDestroy()
 {
    const me = this.constructor.name + '.ngOnDestroy(): ';
    console.log( me);
    if (this._currentClusterSubscription)
       this._currentClusterSubscription.unsubscribe();
 }
開發者ID:JohnL4,項目名稱:Diaspora,代碼行數:7,代碼來源:cluster-details.component.ts

示例3: 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

示例4:

 (navTabName: string) => {
     if( navTabName !== name && !this.vhostTreeSubs.isUnsubscribed ) { // 플레이어 탭이 아닐 때
         this.vhostTreeSubs.unsubscribe();
         this.stopAllPlayers();
     }
     else {
         this.subscribeVhostTree();
         this.reloadAllPlayers();
     }
 }
開發者ID:BaeHongil,項目名稱:VMS,代碼行數:10,代碼來源:players.component.ts

示例5: Subscription

    return Observable.create(o => {
      log.debug(
        `Doing a RPC to [${remoteProcedure}]. Is connected [${this
          .isConnected}]`
      )

      const disposables = new Subscription()
      if (!this.isConnected) {
        o.error(
          new Error(
            `Session not connected, can\'t perform remoteProcedure ${remoteProcedure}`
          )
        )
        return disposables
      }
      let isDisposed
      const dto = [
        {
          payload,
          replyTo: responseTopic,
          Username: this.userName
        }
      ]

      this.autobahn.session.call(remoteProcedure, dto).then(
        result => {
          if (!isDisposed) {
            o.next(result)
            o.complete()
          } else {
            log.verbose(
              `Ignoring response for remoteProcedure [${remoteProcedure}] as stream disposed`
            )
          }
        },
        error => {
          if (!isDisposed) {
            o.error(error)
          } else {
            log.error(
              `Ignoring error for remoteProcedure [${remoteProcedure}] as stream disposed.`,
              error
            )
          }
        }
      )

      const sub = new Subscription()
      sub.unsubscribe()
      disposables.add(sub)

      return disposables
    })
開發者ID:carlosrfernandez,項目名稱:ReactiveTraderCloud,代碼行數:53,代碼來源:connection.ts

示例6: removePreLoader

  private removePreLoader() {
    if(document) {
      let $body = document.body;
      let preloader = document.getElementById('preloader');
      if(preloader) {
        $body.removeChild(preloader);
        this.routeEventsSubscription.unsubscribe();
      }
      $body.classList.remove('loading');

    }
  }
開發者ID:HerringtonDarkholme,項目名稱:Deneb,代碼行數:12,代碼來源:app.component.ts

示例7: setTimeout

                setTimeout(() => {
                    if (value.indexOf("/") !== -1) {
                        o.next({ noSlashAsync: true });
                    } else {
                        o.next(null);
                    }

                    // wait for bug update. maybe at final release.
                    console.log(v);

                    o.complete();
                    s.unsubscribe();
                }, 1000);
開發者ID:zhaowenjunzz,項目名稱:StudyAngular2,代碼行數:13,代碼來源:custom-validators.ts

示例8: add

  add(teardownSrc: TeardownLogic): Subscription {
    let teardown: any = teardownSrc
    if (this.closed) return this
    if (typeof(teardownSrc) === 'function') teardown = new Subscription(teardown)

    if (this.currentSubscription) {
      this.remove(this.currentSubscription)
      this.currentSubscription.unsubscribe()
      this.currentSubscription = null
    }

    super.add(this.currentSubscription = teardown)
    return this
  }
開發者ID:carlosrfernandez,項目名稱:ReactiveTraderCloud,代碼行數:14,代碼來源:serialSubscription.ts

示例9: runTasks

 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);
     });
 }
開發者ID:rumnha,項目名稱:AzureFunctionsPortal,代碼行數:21,代碼來源:background-tasks.service.ts

示例10: ngOnDestroy

 ngOnDestroy() {
   this.taskListsSubscriptionSubscription.unsubscribe();
   if (this.taskListsSubscription != null) {
     this.taskListsSubscription.unsubscribe();
   }
 }
開發者ID:hanaum,項目名稱:choose_to_go,代碼行數:6,代碼來源:userListView.component.ts


注:本文中的rxjs/Rx.Subscription.unsubscribe方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。