MCPcopy Create free account
hub / github.com/composify-js/composify / constructor

Method constructor

packages/react/src/utils/Bridge/Bridge.ts:12–24  ·  view source on GitHub ↗
(target: Window, origin = '*')

Source from the content-addressed store, hash-verified

10 private listeners = new Map<BridgeEventType, Set<BridgeEventHandler>>();
11
12 public constructor(target: Window, origin = '*') {
13 this.target = target;
14 this.origin = origin;
15
16 this.on = this.on.bind(this);
17 this.emit = this.emit.bind(this);
18 this.dispose = this.dispose.bind(this);
19 this.handle = this.handle.bind(this);
20
21 window.addEventListener('message', this.handle, {
22 signal: this.abort.signal,
23 });
24 }
25
26 public emit(event: BridgeEvent) {
27 this.target.postMessage(event, this.origin);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected