本文整理汇总了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;
});