refactor(SceneController): rename SceneMgr to SceneController

This commit is contained in:
Christian Weimann
2025-01-14 03:54:21 +01:00
parent de8e708088
commit 13bbf41d0b

View File

@@ -1,7 +1,7 @@
// Settings // Settings
const ITEMPREFIX = "System_StatefulScene"; const ITEMPREFIX = "System_StatefulScene";
const DEBOUNCETIME = 3000; const DEBOUNCETIME = 3000;
const LOGGER = "org.openhab.js.SceneMgr"; const LOGGER = "org.openhab.js.SceneController";
// Logging // Logging
const log = Java.type('org.slf4j.LoggerFactory').getLogger(LOGGER); const log = Java.type('org.slf4j.LoggerFactory').getLogger(LOGGER);
@@ -13,11 +13,11 @@ const tm = new TimerMgr();
const { ruleRegistry } = require('@runtime/RuleSupport'); const { ruleRegistry } = require('@runtime/RuleSupport');
// Functions // Functions
class SceneMgr { class SceneController {
constructor() { constructor() {
// Log the initialization message for Scene Manager. // Log the initialization message for SceneController.
log.info('Initialization of SceneMgr'); log.info('Initialization of SceneController');
// Initialize the scenes map by reducing the array of scenes into an object with unique IDs as keys. // Initialize the scenes map by reducing the array of scenes into an object with unique IDs as keys.
this.scenes = this.getScenes().reduce((scenes, scene) => { this.scenes = this.getScenes().reduce((scenes, scene) => {
@@ -259,11 +259,11 @@ class Scene {
} }
// Load script // Load script
const sm = new SceneMgr(); const sm = new SceneController();
// Unload script // Unload script
require('@runtime').lifecycleTracker.addDisposeHook(() => { require('@runtime').lifecycleTracker.addDisposeHook(() => {
log.info('Deinitialization of SceneMgr'); log.info('Deinitialization of SceneController');
sm.purgeUnusedSceneSwitchItems(); sm.purgeUnusedSceneSwitchItems();