MCPcopy
hub / github.com/vercel/hyper / constructor

Method constructor

lib/utils/rpc.ts:8–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6 ipc: IpcRenderer;
7 id!: string;
8 constructor() {
9 this.emitter = new EventEmitter();
10 this.ipc = electron.ipcRenderer;
11 if (window.__rpcId) {
12 setTimeout(() => {
13 this.id = window.__rpcId;
14 this.ipc.on(this.id, this.ipcListener);
15 this.emitter.emit('ready');
16 }, 0);
17 } else {
18 this.ipc.on('init', (ev: IpcRendererEvent, uid: string) => {
19 // we cache so that if the object
20 // gets re-instantiated we don't
21 // wait for a `init` event
22 window.__rpcId = uid;
23 this.id = uid;
24 this.ipc.on(uid, this.ipcListener);
25 this.emitter.emit('ready');
26 });
27 }
28 }
29
30 ipcListener = (event: any, {ch, data}: {ch: string; data: any}) => {
31 this.emitter.emit(ch, data);

Callers

nothing calls this directly

Calls 2

onMethod · 0.80
emitMethod · 0.45

Tested by

no test coverage detected