electron now searches for node helper scripts on module folders

This commit is contained in:
Paul-Vincent Roll 2016-03-27 22:22:04 +02:00
parent d96b82500a
commit d7844a1e39
3 changed files with 22 additions and 1 deletions

View File

@ -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);

View File

@ -0,0 +1,2 @@
'use strict';
console.log("test");

View File

@ -22,6 +22,7 @@
},
"homepage": "https://github.com/MichMich/MagicMirror#readme",
"devDependencies": {
"electron-prebuilt": "^0.36.0"
"electron-prebuilt": "^0.36.0",
"walk": "latest"
}
}