mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
electron now searches for node helper scripts on module folders
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
//for searching modules
|
||||
const walk = require('walk');
|
||||
|
||||
const electron = require('electron');
|
||||
// Module to control application life.
|
||||
const app = electron.app;
|
||||
@@ -29,6 +32,21 @@ function createWindow () {
|
||||
});
|
||||
}
|
||||
|
||||
//Start helper scripts
|
||||
var walker = walk.walk(__dirname + '/../modules', { followLinks: false });
|
||||
|
||||
walker.on('file', function(root, stat, next) {
|
||||
if (stat.name == "node_helper.js"){
|
||||
require(root + '/' + stat.name);
|
||||
}
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
walker.on('end', function() {
|
||||
console.log("Helpers startet");
|
||||
});
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
// initialization and is ready to create browser windows.
|
||||
app.on('ready', createWindow);
|
||||
|
Reference in New Issue
Block a user