updated registration logic to be consise
This commit is contained in:
4
index.js
4
index.js
@@ -12,12 +12,11 @@ const outputUtils = require('./src/helper/outputUtils.js');
|
|||||||
const logger = require('./src/helper/logger.js');
|
const logger = require('./src/helper/logger.js');
|
||||||
const validation = require('./src/helper/validationUtils.js');
|
const validation = require('./src/helper/validationUtils.js');
|
||||||
const configUtils = require('./src/helper/configUtils.js');
|
const configUtils = require('./src/helper/configUtils.js');
|
||||||
const assertions = require('./src/helper/assertionUtils.js')
|
|
||||||
|
|
||||||
// Domain-specific modules
|
// Domain-specific modules
|
||||||
const { MeasurementContainer } = require('./src/measurements/index.js');
|
const { MeasurementContainer } = require('./src/measurements/index.js');
|
||||||
const configManager = require('./src/configs/index.js');
|
const configManager = require('./src/configs/index.js');
|
||||||
const nrmse = require('./src/nrmse/errorMetrics.js');
|
const nrmse = require('./src/nrmse/ErrorMetrics.js');
|
||||||
const state = require('./src/state/state.js');
|
const state = require('./src/state/state.js');
|
||||||
const convert = require('./src/convert/index.js');
|
const convert = require('./src/convert/index.js');
|
||||||
const MenuManager = require('./src/menu/index.js');
|
const MenuManager = require('./src/menu/index.js');
|
||||||
@@ -35,7 +34,6 @@ module.exports = {
|
|||||||
configUtils,
|
configUtils,
|
||||||
logger,
|
logger,
|
||||||
validation,
|
validation,
|
||||||
assertions,
|
|
||||||
MeasurementContainer,
|
MeasurementContainer,
|
||||||
nrmse,
|
nrmse,
|
||||||
state,
|
state,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"general": {
|
"general": {
|
||||||
"name": {
|
"name": {
|
||||||
"default": "Measurement Configuration",
|
"default": "Sensor",
|
||||||
"rules": {
|
"rules": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "A human-readable name or label for this measurement configuration."
|
"description": "A human-readable name or label for this measurement configuration."
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ class ChildRegistrationUtils {
|
|||||||
registeredAt: Date.now()
|
registeredAt: Date.now()
|
||||||
});
|
});
|
||||||
|
|
||||||
// IMPORTANT: Only call parent registration - no automatic handling
|
// IMPORTANT: Only call parent registration - no automatic handling and if parent has this function then try to register this child
|
||||||
if (typeof this.mainClass.registerOnChildEvents === 'function') {
|
if (typeof this.mainClass.registerChild === 'function') {
|
||||||
this.mainClass.registerOnChildEvents();
|
this.mainClass.registerChild(child, softwareType);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.info(`✅ Child ${name} registered successfully`);
|
this.logger.info(`✅ Child ${name} registered successfully`);
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ class MeasurementContainer {
|
|||||||
|
|
||||||
// Emit the exact event your parent expects
|
// Emit the exact event your parent expects
|
||||||
this.emitter.emit(`${this._currentType}.${this._currentVariant}.${this._currentPosition}`, eventData);
|
this.emitter.emit(`${this._currentType}.${this._currentVariant}.${this._currentPosition}`, eventData);
|
||||||
|
//console.log(`Emitted event: ${this._currentType}.${this._currentVariant}.${this._currentPosition}`, eventData);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user