0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-24 20:29:23 +01:00
nodejs/typings/internalBinding/messaging.d.ts
Yagiz Nizipli da7962fd4d
lib: fix internalBinding typings
PR-URL: https://github.com/nodejs/node/pull/49742
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2023-09-23 10:48:34 +00:00

33 lines
1.2 KiB
TypeScript

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 {}
}
export interface MessagingBinding {
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;
}