@xpgamesllc/ipcs-be
Version:
A set of standardized types and functions for interacting with other Minecraft Bedrock Edition add-ons.
21 lines (19 loc) • 833 B
text/typescript
declare function setVersion(v: number): void;
/**
* Send a script event, fragmenting JSON/text payload if needed. Optionally receive a response.
* @param channel - The script-event channel to send to.
* @param payload - The payload to send.
* @param opts - Optional encoding and message ID.
* @param callback - Optional callback to receive a response.
*/
declare function send(channel: string, payload: any, opts?: {
encoding?: string;
id?: string;
}, callback?: (response: any) => void): void;
/**
* Subscribe to reassembled messages on a channel.
* @param channel - The script-event channel to subscribe to.
* @param cb - The callback to invoke when a message is received.
*/
declare function on(channel: string, cb: (payload: any, respond?: (resp: any) => void) => void): void;
export { on, send, setVersion };