import { XOR } from "../data-utilities/type.utilities.js"; import { Initialize, MessageSystemConfig, Register } from "./message-system.props.js"; import { MessageSystemIncoming } from "./message-system.utilities.props.js"; /** * The registration used for the message system */ export default class MessageSystem { /** * The list of items registered to the message system registry */ private register; /** * The web worker */ private worker; /** * The history limit */ private historyLimit; /** * The message queue */ private messageQueue; constructor(config: MessageSystemConfig); /** * Add an item to the register */ add(config: Register): void; /** * Remove an item from the register */ remove(config: Register): void; /** * Sends an initialization message */ initialize(config: Initialize): void; /** * Post a message to the message system web worker */ postMessage(message: MessageSystemIncoming): void; /** * The onmessage handler for the message system which recieves a message * from the message system web worker and passes it to each registered item */ private onMessage; /** * Fire the messages in the order they have been received when they are made available */ private sendNextMessage; /** * Clears the next message to be sent in the message queue */ private clearNextMessage; /** * Get a registered items config */ getConfigById(id: string): XOR; }