Files
drb-server/addons/example/index.js
Logan Cusano 2ab5a181bd
All checks were successful
DRB Tests / drb_mocha_tests (pull_request) Successful in 32s
#5 replace all console.logs with debugger
2024-05-25 23:52:18 -04:00

20 lines
698 B
JavaScript

// addons/addon1/index.js
import { DebugBuilder } from "../../modules/debugger.mjs";
const log = new DebugBuilder("server", "server");
// Function called by the main application to initialize the addon
export function initialize(nodeIo, config) {
log.INFO(`Initializing ${config.name}`);
// Call other functions within the addon module
registerSocketEvents(nodeIo, config);
// Call additional initialization functions if needed
}
// Function to register Socket.IO event handlers
function registerSocketEvents(nodeIo, config) {
nodeIo.on(config.options.eventName, (data) => {
log.DEBUG(`Received event "${config.options.eventName}" from client:`, data);
});
}