本文整理汇总了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);
}
});
示例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)
}
})
示例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;
}
示例4:
(counties: County[]) => {
if (!this._counties$.getValue().length) {
counties.forEach((county: County) =>
this._counties$.getValue().push(county));
}
this._counties$.next(this._counties$.getValue());
},
示例5:
ref.child(key).on('value', snapshot => {
if (snapshot.exists()) {
let model = snapshot.val();
model.$key = snapshot.key;
return model$.next(model);
}
});
示例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));
});
示例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);
}
示例8:
.subscribe(state => {
subject$.next(state);
});
示例9: loginUser
loginUser(user: User): void {
this.currentUser.next(user);
}