本文整理匯總了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);
}
})
示例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();
}
}
示例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;
})
示例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;
})
示例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();
});
示例6: setConfig
setConfig(name: string, value: any) {
if (!this[name]) {
this[name] = new BehaviorSubject({});
}
this[name].next(value);
}
示例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();
}
示例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);
}
示例9:
accounts.forEach(account => {
if (account.id === this.userSessionStore.account.id) {
let session = this.userSessionStore;
this.userSessionStore = { account: session.account };
this._userSession.next(session);
}
});
示例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;
});