nx/graph/shared/src/lib/external-api-service.ts
MaxKless 6528da3bd8
feat(graph): add atomizer label to target groups (#26622)
## Current Behavior
Atomized Groups are treated just like any other groups in the PDV

## Expected Behavior
We want to let people know that something was created by the Atomizer
and also surface more information to users.
2024-06-26 10:17:59 -04:00

25 lines
601 B
TypeScript

let externalApiService: ExternalApiService | null = null;
export function getExternalApiService() {
if (!externalApiService) {
externalApiService = new ExternalApiService();
}
return externalApiService;
}
export class ExternalApiService {
private subscribers: Set<(event: { type: string; payload?: any }) => void> =
new Set();
postEvent(event: { type: string; payload?: any }) {
this.subscribers.forEach((subscriber) => {
subscriber(event);
});
}
subscribe(callback: (event: { type: string; payload: any }) => void) {
this.subscribers.add(callback);
}
}