aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/services
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-04-24 15:22:05 +0800
committercrupest <crupest@outlook.com>2022-04-24 15:22:05 +0800
commit3bc8ee1de171f0bd8e226542d75c842c5b2e7175 (patch)
tree408cea3b767dc5768ad3c08d6e547c876ce1175e /FrontEnd/src/services
parentd8adfa6b141c8e3a8f11592b831c574dee8602b9 (diff)
downloadtimeline-3bc8ee1de171f0bd8e226542d75c842c5b2e7175.tar.gz
timeline-3bc8ee1de171f0bd8e226542d75c842c5b2e7175.tar.bz2
timeline-3bc8ee1de171f0bd8e226542d75c842c5b2e7175.zip
...
Diffstat (limited to 'FrontEnd/src/services')
-rw-r--r--FrontEnd/src/services/timeline.ts20
1 files changed, 14 insertions, 6 deletions
diff --git a/FrontEnd/src/services/timeline.ts b/FrontEnd/src/services/timeline.ts
index d8c0ae00..cb5b1e32 100644
--- a/FrontEnd/src/services/timeline.ts
+++ b/FrontEnd/src/services/timeline.ts
@@ -21,7 +21,8 @@ export const timelineVisibilityTooltipTranslationMap: Record<
};
export function getTimelinePostUpdate$(
- timelineName: string
+ owner: string,
+ timeline: string
): Observable<{ update: boolean; state: HubConnectionState }> {
return new Observable((subscriber) => {
subscriber.next({
@@ -37,8 +38,11 @@ export function getTimelinePostUpdate$(
.withAutomaticReconnect()
.build();
- const handler = (tn: string): void => {
- if (timelineName === tn) {
+ const o = owner;
+ const t = timeline;
+
+ const handler = (owner: string, timeline: string): void => {
+ if (owner === o && timeline === t) {
subscriber.next({ update: true, state: connection.state });
}
};
@@ -64,12 +68,16 @@ export function getTimelinePostUpdate$(
});
});
- connection.on("OnTimelinePostChanged", handler);
+ connection.on("OnTimelinePostChangedV2", handler);
void connection.start().then(() => {
subscriber.next({ update: false, state: HubConnectionState.Connected });
- return connection.invoke("SubscribeTimelinePostChange", timelineName);
+ return connection.invoke(
+ "SubscribeTimelinePostChangeV2",
+ owner,
+ timeline
+ );
});
return () => {
@@ -77,7 +85,7 @@ export function getTimelinePostUpdate$(
if (connection.state === HubConnectionState.Connected) {
void connection
- .invoke("UnsubscribeTimelinePostChange", timelineName)
+ .invoke("UnsubscribeTimelinePostChangeV2", owner, timeline)
.then(() => connection.stop());
}
};