MCPcopy
hub / github.com/React95/React95 / on

Method on

packages/core/components/shared/emitter.ts:4–9  ·  view source on GitHub ↗
(eventName: U, callback: (data: Partial<T>) => void)

Source from the content-addressed store, hash-verified

2 private listeners: { [key in U]?: Array<(data: Partial<T>) => void> } = {};
3
4 on(eventName: U, callback: (data: Partial<T>) => void) {
5 if (!this.listeners[eventName]) {
6 this.listeners[eventName] = [];
7 }
8 this.listeners[eventName]?.push(callback);
9 }
10
11 off(eventName: U, callback: (data: Partial<T>) => void) {
12 if (this.listeners[eventName]) {

Callers 2

events.test.tsFile · 0.80
useModalFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected