fix: guard demo IIFE with require.main check
Prevents demo code from executing when module is required by Node-RED, which caused crashes due to missing measurement data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -613,7 +613,8 @@ function pushSample(measurement, type, value, unit) { // eslint-disable-line no-
|
||||
}
|
||||
|
||||
/** Demo *********************************************************************/
|
||||
(async function demoStationWithPump() {
|
||||
// Only run the demo when this file is executed directly (not when required as a module)
|
||||
if (require.main === module) (async function demoStationWithPump() {
|
||||
const station = new PumpingStation(createPumpingStationConfig("PumpingStationDemo"));
|
||||
const pump = new RotatingMachine(createMachineConfig("Pump1"), createMachineStateConfig());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user