@sodacore/ws
Version:
Sodacore ws is a core plugin that extends the Http plugin offering WebSocket support to the Sodacore framework.
16 lines (15 loc) • 534 B
JavaScript
import { Utils } from '@sodacore/di';
/**
* This decorator is used by the WS package to expose a method
* within a controller for the WebSocket to be called, a command
* is a format of: `namespace/methodName`.
* @returns MethodDecorator
* @default
*/
export default function Expose() {
return (target, propertyKey) => {
const exposed = Utils.getMeta('exposed', 'ws')(target.constructor, undefined, []);
exposed.push(propertyKey);
Utils.setMeta('exposed', 'ws')(target.constructor, exposed);
};
}