SocketIORouter: Add ability to unregister handler

This will make it easier to add tests.
pull/5171/head
Richard Hansen 2021-09-06 03:17:39 -04:00
parent 2e93fca699
commit 94f71bd5e9
1 changed files with 3 additions and 1 deletions

View File

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