package.dist.decorators.event.js Maven / Gradle / Ivy
/**
* Returns an event class decorator.
*
* @param { string } name the event name
* @param { EventData } data the event data
* @returns { ClassDecorator }
*/
const event = (name, data = {}) => {
return (target) => {
if (!Object.prototype.hasOwnProperty.call(target, "metadata")) {
target.metadata = {};
}
const metadata = target.metadata;
if (!metadata.events) {
metadata.events = {};
}
const eventsMetadata = metadata.events;
if (!eventsMetadata[name]) {
eventsMetadata[name] = data;
}
};
};
export default event;
//# sourceMappingURL=event.js.map