Spaces:
Configuration error
Configuration error
Download frontend/src/workspace/WorkspaceEvents.ts from varshithreddy1807/aria: direct link, hf CLI and curl.
- Browser
- Download file 658 Bytes
-
https://huggingface.co/spaces/varshithreddy1807/aria/resolve/main/frontend/src/workspace/WorkspaceEvents.ts
- Command line
-
hf download hf://spaces/varshithreddy1807/aria/frontend/src/workspace/WorkspaceEvents.ts
-
curl -L -o WorkspaceEvents.ts https://huggingface.co/spaces/varshithreddy1807/aria/resolve/main/frontend/src/workspace/WorkspaceEvents.ts
658 Bytes
| type EventCallback = (data: any) => void; | |
| export class WorkspaceEvents { | |
| private listeners: Map<string, Set<EventCallback>> = new Map(); | |
| public on(event: string, callback: EventCallback): void { | |
| if (!this.listeners.has(event)) { | |
| this.listeners.set(event, new Set()); | |
| } | |
| this.listeners.get(event)!.add(callback); | |
| } | |
| public off(event: string, callback: EventCallback): void { | |
| if (this.listeners.has(event)) { | |
| this.listeners.get(event)!.delete(callback); | |
| } | |
| } | |
| public emit(event: string, data?: any): void { | |
| if (this.listeners.has(event)) { | |
| this.listeners.get(event)!.forEach((cb) => cb(data)); | |
| } | |
| } | |
| } | |