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