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


TypeScript BehaviorSubject.next方法代碼示例

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


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

示例1:

 this.document.addEventListener("visibilitychange", () => {
   if (document.visibilityState === "visible") {
     this.detailedFocusSubject.next(DetailedFocusStates.TabFocus);
   } else {
     this.detailedFocusSubject.next(DetailedFocusStates.TabBlur);
   }
 });
開發者ID:sstorie,項目名稱:experiments,代碼行數:7,代碼來源:window-focus.service.ts

示例2:

 this.autobahn.onclose((reason, details) => {
   log.error(`Connection lost, reason: [${reason}]`)
   log.error(`Connection lost, details: [${JSON.stringify(details)}]`)
   this.isConnected = false
   const disconnectTimerDisposable = this.autoDisconnectDisposable
   if (disconnectTimerDisposable) {
     disconnectTimerDisposable.unsubscribe()
   }
   // if we explicitly called close then we move to ConnectionStatus.idle status
   if (reason === 'closed') {
     this.connectionStatusSubject.next(ConnectionStatus.sessionExpired)
   } else {
     this.connectionStatusSubject.next(ConnectionStatus.disconnected)
   }
 })
開發者ID:tdeheurles,項目名稱:ReactiveTraderCloud,代碼行數:15,代碼來源:connection.ts

示例3: PresentationOnBreakpoint

export function PresentationOnBreakpoint(
    breakpoints: {
        breakpoint: number;
        presentation: GridBodyPresentation
    }[]
): BehaviorSubject<GridBodyPresentation> {
    
    function getPresentation() {
        var width = window.outerWidth, i = 0;
        
        while (i < breakpoints.length - 1 && breakpoints[i + 1].breakpoint < width) {
            i++;
        }
        
        return breakpoints[i].presentation;
    }
    
    breakpoints.sort((a, b) => a.breakpoint - b.breakpoint);
    
    let subject = new BehaviorSubject<GridBodyPresentation>(getPresentation());
    
    function listener() {
        subject.next(getPresentation());
    }
    
    subject.next(getPresentation());
    
    window.addEventListener('resize', listener);
    
    return subject;
}
開發者ID:Azure,項目名稱:azure-iot-library,代碼行數:31,代碼來源:grid.presentation.ts

示例4:

 (counties: County[]) => {
   if (!this._counties$.getValue().length) {
     counties.forEach((county: County) =>
     this._counties$.getValue().push(county));
   }
   this._counties$.next(this._counties$.getValue());
 },
開發者ID:praetorxyn,項目名稱:angular2-interactive-map,代碼行數:7,代碼來源:county.service.ts

示例5:

 ref.child(key).on('value', snapshot => {
   if (snapshot.exists()) {
     let model = snapshot.val();
     model.$key =  snapshot.key;
     return model$.next(model);
   }
 });
開發者ID:simbiosis-group,項目名稱:ion2-helper,代碼行數:7,代碼來源:firebase-helper.ts

示例6:

 this._user.auth.onAuthStateChanged(user => {
     this.isAuth.next(!!user);
     this._cd.detectChanges();
     this._data.db.child('/private').on('value', data => {
         this.privateData.next(data.val());
         this._cd.detectChanges();
     }, err => console.log(err));
 });
開發者ID:colinjlacy,項目名稱:firebase-ionic-2-demo,代碼行數:8,代碼來源:auth.ts

示例7: addTag

  addTag(tag:any){
    if (this.tags.some(t => t.id === tag.id)) {
      alert("you already added that one, dummy!")
      return;
    }

    this.tags.push(tag);
    this.tags$.next(this.tags);
  }
開發者ID:idledrop,項目名稱:code-irl-ui,代碼行數:9,代碼來源:tag-list.model.ts

示例8:

 .subscribe(state => {
     subject$.next(state);
 });
開發者ID:gwhn,項目名稱:ng-rxjs-state-dispatch,代碼行數:3,代碼來源:state-fn.ts

示例9: loginUser

 loginUser(user: User): void {
     this.currentUser.next(user);
 }
開發者ID:mayacoda,項目名稱:stories,代碼行數:3,代碼來源:user.service.ts


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