本文整理汇总了TypeScript中rx.Subject.onNext方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Subject.onNext方法的具体用法?TypeScript Subject.onNext怎么用?TypeScript Subject.onNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rx.Subject
的用法示例。
在下文中一共展示了Subject.onNext方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: addMediaEvents
const sub$ = Rx.Observable.combineLatest(...days).subscribe(data => {
const totals = addMediaEvents(data.map(d => d.mediaEvent));
data$.onNext(data);
totals$.onNext(totals);
sub$.dispose();
});
示例2: if
connection.on("message", (message: WebSocketMessage) => {
if (message.type == "utf8") {
this.onMessage_.onNext({ string: message.utf8Data });
} else if (message.type == "binary") {
this.onMessage_.onNext({ data: bufferToData(message.binaryData) });
} else {
throw new Error(`invalid message ${message.type}`);
}
});
示例3: function
request<any>(options, function(err, response) {
if(err) {
observable.onError(err);
} else {
observable.onNext(response.body);
}
})
示例4: function
socket.on(name + id, function([value, error, completed]) {
if (completed) {
observer.onCompleted()
} else if (error) {
observer.onError(error)
} else {
observer.onNext(value)
}
}).emit(name + id, true)
示例5: catch
sub = this.socket_.onMessage().subscribeOnNext((message: SocketMessage) => {
if (message.string != null) {
try {
const json = Json.parse(message.string);
const msg = this.messageDecoder_.decode(json);
this.onMessage_.onNext(msg);
} catch (e) {
this.handleError(toError(e));
}
} else {
this.handleError(new Error(`invalid message`));
}
});
示例6: onNext
protected onNext(action) {
this.observable.onNext(action);
}
示例7:
runnerObservable.subscribe(data => {
subject.onNext(data);
}, reason => {
示例8: changesCommitted
export function changesCommitted(msg: string) {
Actions.onNext(commitChanges(msg));
}
示例9: todos
public set todos(todos) {
this._todos = List.isList(todos) ? todos : fromJS(todos);
this.todosObservable.onNext(this._todos);
}