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


TypeScript BehaviorSubject.next方法代碼示例

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


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

示例1:

 this.textInput.valueChanges.debounceTime(500).subscribe((value)=>{
     if(this._validate(value)) {
         this.textInput.setValue(value);
         this.value.next(value);
     } else {
         this.textInput.setValue(this._currentValue);
         this.value.next(this._currentValue);
     }
 })
開發者ID:EremenkoAndrey,項目名稱:july,代碼行數:9,代碼來源:product-count.component.ts

示例2: setDrinkTimestamps

 setDrinkTimestamps(startAt: string, endAt: string): void {
   clearTimeout(this.startDrinksAtTimestampCallback);
   clearTimeout(this.endDrinksAtTimestampCallback);
   if (startAt && endAt) {
     this.startDrinksAtTimestamp.next(startAt);
     this.endDrinksAtTimestamp.next(endAt);
   } else if (startAt) {
     this.startDrinksAtTimestamp.next(startAt);
     this.updateEndDrinksAtTimestamp();
   } else {
     this.updateStartDrinksAtTimestamp();
     this.updateEndDrinksAtTimestamp();
   }
 }
開發者ID:adamstegman,項目名稱:drank,代碼行數:14,代碼來源:drinks.service.ts

示例3:

 .map(isParticipant => {
     this._currentUser.member.matchplayParticipant = isParticipant;
     this.saveToStorage('bhmc_user', JSON.stringify(this._currentUser));
     this.errorHandler.setUserContext(this._currentUser);
     this.currentUserSource.next(this._currentUser);
     return;
 })
開發者ID:finleysg,項目名稱:bhmc,代碼行數:7,代碼來源:authentication.service.ts

示例4: User

 .map(data => {
     let user = new User().fromJson(data);
     this.saveToStorage('bhmc_user', JSON.stringify(user));
     this._currentUser = user;
     this.currentUserSource.next(this._currentUser);
     return;
 })
開發者ID:finleysg,項目名稱:bhmc,代碼行數:7,代碼來源:authentication.service.ts

示例5: beforeEach

    beforeEach(() => {
        addProviders([
            { provide: Platform, useClass: MockClass },
            { provide: Http, useClass: HttpMock },
            { provide: NavController, useClass: NavMock },
            { provide: DataService, useClass: MockDataService },
        ]);
 
        platform      = new MockClass();
        navMock       = new NavMock();
        window.localStorage.setItem('project_data', JSON.stringify(platform.getData()));

        data          = platform.getData();
        var _data     = JSON.stringify(data);

        //Set Initial State
        window.localStorage.setItem('project_data', _data);
        window.localStorage.setItem('project_id', '5');

        observable    = new BehaviorSubject(data);
        observable.next(data);

        dataService   = new DataService(httpMock);
        spyOn(dataService, 'fetchData').and.returnValue(observable);

        chart         = new Chart(dataService);
        netattraction = new Netattraction();
    });
開發者ID:peb7268,項目名稱:ionic-dashboard,代碼行數:28,代碼來源:netattraction.spec.ts

示例6: setConfig

	setConfig(name: string, value: any) {
		if (!this[name]) {
			this[name] = new BehaviorSubject({});
		}

		this[name].next(value);
	}
開發者ID:radfahrer,項目名稱:BossyUI,代碼行數:7,代碼來源:config.service.ts

示例7: getWorkItemList

    getWorkItemList(idList: Array<number>) : Observable<WorkItemList> {
        let returnValue = new WorkItemList();
        let subject = new BehaviorSubject<WorkItemList>(null);

        if (idList.length > 0) {
            let server = this.window.localStorage.getItem('server');
            
            let workItemUrl = server + '/DefaultCollection/_apis/wit/WorkItems?ids=' + idList.join() + '&fields=System.Id,System.WorkItemType,System.Title,System.AssignedTo,System.State&api-version=1.0';

            this.oAuthHttp.get(workItemUrl).subscribe(res => {
                let result = res.json();

                result.value.forEach(workItemJson => {
                    let workItem = new WorkItem();
                    workItem.populate(workItemJson);
                    returnValue.push(workItem);
                });

                subject.next(returnValue);
            });
        }
        else {
            subject.next(returnValue);
        }

        return subject.asObservable();
    }
開發者ID:CaringIsCreepy,項目名稱:VSTS-Mobile,代碼行數:27,代碼來源:work-item-service.ts

示例8: registerApp

  public registerApp(appClass: AppClass = App, opts: RegisterAppOptions = {}) {
    const options = {
      multi: false,
      ...opts,
    };

    if (typeof options.name !== 'undefined') {
      Object.defineProperty(appClass, 'frintAppName', {
        value: options.name,
        configurable: true,
      });
    }

    const existingIndex = findIndex(this._appsCollection, (w) => {
      return w.name === appClass.frintAppName;
    });

    if (existingIndex !== -1) {
      throw new Error(`App '${appClass.frintAppName}' has been already registered before.`);
    }

    this._appsCollection.push({
      ...options,
      name: appClass.frintAppName,
      appClass,
      instances: {},
      regions: options.regions || [],
    });

    if (options.multi === false) {
      this.instantiateApp(appClass.frintAppName);
    }

    this._apps$.next(this._appsCollection);
  }
開發者ID:Travix-International,項目名稱:frint,代碼行數:35,代碼來源:App.ts

示例9:

 accounts.forEach(account => {
   if (account.id === this.userSessionStore.account.id) {
     let session = this.userSessionStore;
     this.userSessionStore = { account: session.account };
     this._userSession.next(session);
   }
 });
開發者ID:vintage-software,項目名稱:vstack-server-demo,代碼行數:7,代碼來源:auth.service.ts

示例10: WobInfoModelList

			.then((contents: WobInfoModelList) => {
				// Cache location contents and notify
				this._locationContents = contents;
				this.locationContents.next(contents);

				var ids: number[] = [];
				contents.list.forEach((wob) => {
					ids.push(wob.id);
				});

				var players: WobInfoModel[] = [];
				this.wobService.instanceOf(ids, "@player")
					.then((results: InstanceOfModelList) => {
						results.list.forEach((result) => {
							if (result.isInstance) {
								players.push(contents.list.find((value: WobInfoModel) =>  {
									return value.id == result.id;
								}));
							}
						});

						// Cache nearby players list and notify
						this._locationPlayers = new WobInfoModelList(players);
						this.locationPlayers.next(this._locationPlayers);
					});

				return contents;
			});
開發者ID:deciare,項目名稱:flowerbox-web-angular,代碼行數:28,代碼來源:status.service.ts


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