MCPcopy Create free account
hub / github.com/Power-Playground/app / constructor

Method constructor

core/src/iframe-bridge.ts:12–25  ·  view source on GitHub ↗
(
    private readonly w: () => (Window | null),
    private readonly targetOrigin: string
  )

Source from the content-addressed store, hash-verified

10 private readonly listeners: Map<string, Function[]> = new Map()
11
12 constructor(
13 private readonly w: () => (Window | null),
14 private readonly targetOrigin: string
15 ) {
16 window.addEventListener('message', e => {
17 if (e.origin !== targetOrigin) {
18 return
19 }
20 const listeners = this.listeners.get(e.data.type)
21 if (listeners) {
22 listeners.forEach(func => func(e.data.data))
23 }
24 })
25 }
26
27 send<
28 T extends Events0['type']

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected