summaryrefslogtreecommitdiff
path: root/typings/internalBinding/messaging.d.ts
blob: ca5be84848408da8fbe0f8ffc225c7c5b7c69259 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
declare namespace InternalMessagingBinding {
  class MessageChannel {
    port1: MessagePort;
    port2: MessagePort;
  }

  class MessagePort {
    private constructor();
    postMessage(message: any, transfer?: any[] | null): void;
    start(): void;
    close(): void;
    ref(): void;
    unref(): void;
  }

  class JSTransferable {}
}


declare function InternalBinding(binding: 'messaging'): {
  DOMException: typeof import('internal/per_context/domexception').DOMException;
  MessageChannel: typeof InternalMessagingBinding.MessageChannel;
  MessagePort: typeof InternalMessagingBinding.MessagePort;
  JSTransferable: typeof InternalMessagingBinding.JSTransferable;
  stopMessagePort(port: typeof InternalMessagingBinding.MessagePort): void;
  checkMessagePort(port: unknown): boolean;
  drainMessagePort(port: typeof InternalMessagingBinding.MessagePort): void;
  receiveMessageOnPort(port: typeof InternalMessagingBinding.MessagePort): any;
  moveMessagePortToContext(port: typeof InternalMessagingBinding.MessagePort, context: any): typeof InternalMessagingBinding.MessagePort;
  setDeserializerCreateObjectFunction(func: (deserializeInfo: string) => any): void;
  broadcastChannel(name: string): typeof InternalMessagingBinding.MessagePort;
};