@arpinum/messaging
Version:
Simple message bus
22 lines (21 loc) • 522 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.messageCreator = messageCreator;
exports.voidMessageCreator = voidMessageCreator;
function messageCreator(type) {
return Object.assign((payload) => ({
type,
payload,
}), typeInformation(type));
}
function voidMessageCreator(type) {
return Object.assign(() => ({
type,
}), typeInformation(type));
}
function typeInformation(type) {
return {
type,
toString: () => type,
};
}