refactor: rewrite NodeHelper as an ES6 class#4147
Merged
khassel merged 1 commit intoMagicMirrorOrg:developfrom May 8, 2026
Merged
refactor: rewrite NodeHelper as an ES6 class#4147khassel merged 1 commit intoMagicMirrorOrg:developfrom
khassel merged 1 commit intoMagicMirrorOrg:developfrom
Conversation
Replaces the legacy Class.extend() inheritance pattern with a native ES6 class. NodeHelper.create() remains the public API and is fully compatible with all third-party modules.
Collaborator
Author
|
The failed Node 26 test seems unrelated to the changes to me. It hangs at the MM installation step; at that point, the modified code is irrelevant. |
khassel
approved these changes
May 8, 2026
Collaborator
yes, tested it on my fork without this PR and same result, maybe introduced with node v26.1.0, will try to test this locally later ... |
Collaborator
|
I found that the line |
Collaborator
Author
|
Great find! |
KristjanESPERANTO
added a commit
to KristjanESPERANTO/MagicMirror
that referenced
this pull request
May 8, 2026
`module.js` still used `Class.extend()`, the same old inheritance helper removed from `node_helper.js` in MagicMirrorOrg#4147. This finishes the cleanup on the browser side. `Module.create()` now follows the same pattern as `NodeHelper.create()`: `Object.assign(this, definition)` in the subclass constructor, `init()` called explicitly. `cloneObject()` moves into `module.js` where it belongs, the `<script>` tag for `class.js` is gone from `index.html`, and newsfeed's `this._super()` becomes `Module.prototype.getDom.call(this)`. Result: one fewer file in the browser bundle, no more magic `_super` wiring, and `module.js` is easier to read without knowing how `Class.extend()` worked.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR rewrites
node_helper.jsto use a native ES6classinstead ofClass.extend()- a manual inheritance helper from 2008, written back whenclasssyntax didn't exist yet. Node.js has supported native classes since v6, so there's no reason to keep the workaround around.The public API is unchanged - module authors still write the same
NodeHelper.create({...})they always have.Outcome: same behavior, normal modern JavaScript, better stack traces, and
node_helper.jsno longer pulls inclass.json the server side. Removingclass.jsaltogether is a follow-up (it's still used on browser side).