You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
733 B
23 lines
733 B
import { NotificationSubscription } from "@ldo/connected";
|
|
import type { NextGraphConnectedPlugin } from "../NextGraphConnectedPlugin.js";
|
|
import type { NextGraphNotificationMessage } from "./NextGraphNotificationMessage.js";
|
|
|
|
export class NextGraphNotificationSubscription extends NotificationSubscription<
|
|
NextGraphConnectedPlugin,
|
|
NextGraphNotificationMessage
|
|
> {
|
|
private unsub: (() => void) | undefined;
|
|
|
|
protected async open(): Promise<void> {
|
|
this.unsub = await this.context.nextgraph.ng.doc_subscribe(
|
|
this.resource.uri,
|
|
this.context.nextgraph.sessionId,
|
|
this.onNotification.bind(this),
|
|
);
|
|
}
|
|
|
|
protected async close(): Promise<void> {
|
|
this.unsub?.();
|
|
this.unsub = undefined;
|
|
}
|
|
}
|
|
|