Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set name and path in module init #3710

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ planned for 2025-04-01
- [core] Fix wrong port in log message when starting server only (#3696)
- [calendar] NewYork event processed on system in Central timezone shows wrong time #3701
- [weather/yr] The Yr weather provider is now able to recover from bad API resposes instead of freezing (#3296)
- [core] Add missing name and path to node_helper init function (#3708)

## [2.30.0] - 2025-01-01

Expand Down
4 changes: 1 addition & 3 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ function App () {
Log.error(`Error when loading ${moduleName}:`, e.message);
return;
}
let m = new Module();
let m = new Module(moduleName, path.resolve(moduleFolder));

if (m.requiresVersion) {
Log.log(`Check MagicMirror² version for node helper '${moduleName}' - Minimum version: ${m.requiresVersion} - Current version: ${global.version}`);
Expand All @@ -222,8 +222,6 @@ function App () {
}
}

m.setName(moduleName);
m.setPath(path.resolve(moduleFolder));
nodeHelpers.push(m);

m.loaded();
Expand Down
7 changes: 5 additions & 2 deletions js/node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ const Log = require("logger");
const Class = require("./class");

const NodeHelper = Class.extend({
init () {
Log.log("Initializing new module helper ...");
init (name, path) {
this.setName(name);
this.setPath(path);

Log.log(`Initializing new module helper: ${this.name}`);
},

loaded () {
Expand Down