SocketIORouter: Add ability to unregister handler

This will make it easier to add tests.
This commit is contained in:
Richard Hansen 2021-09-06 03:17:39 -04:00
parent 2e93fca699
commit 94f71bd5e9

View file

@ -39,11 +39,13 @@ let io;
* adds a component * adds a component
*/ */
exports.addComponent = (moduleName, module) => { exports.addComponent = (moduleName, module) => {
// save the component if (module == null) return exports.deleteComponent(moduleName);
components[moduleName] = module; components[moduleName] = module;
module.setSocketIO(io); module.setSocketIO(io);
}; };
exports.deleteComponent = (moduleName) => { delete components[moduleName]; };
/** /**
* sets the socket.io and adds event functions for routing * sets the socket.io and adds event functions for routing
*/ */