本文整理匯總了TypeScript中rxjs/Subject.Subject.publish方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Subject.publish方法的具體用法?TypeScript Subject.publish怎麽用?TypeScript Subject.publish使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rxjs/Subject.Subject
的用法示例。
在下文中一共展示了Subject.publish方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: connect
connect(topic: string, userEventData: UserEventData) {
this.topic = topic;
this.localSubject$ = new Subject();
const stream = this.localSubject$.publish().refCount();
this.webSocketService.connect(this.localSubject$, topic);
this.ruleStream$ = stream
.filter(wsData => wsData.resourceType === Resource.Rule)
.flatMap(data => this.handleRuleEvent(data, data.sessionId, userEventData))
.publish()
.refCount();
// update userEventData even if no one else subscribes
this.ruleStream$
.subscribe(null, err => this.errorService.showError("error in rule events", err));
}