First round of undef fixes

This commit is contained in:
rejas
2020-05-02 10:39:09 +02:00
parent d8f093b226
commit b9d19cfcb4
22 changed files with 56 additions and 50 deletions

View File

@@ -3,6 +3,7 @@
* MIT Licensed.
*/
// Inspired by base2 and Prototype
(function () {
var initializing = false;

View File

@@ -6,9 +6,8 @@
* By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed.
*/
var port = 8080;
var address = "localhost";
var port = 8080;
if (typeof(mmPort) !== "undefined") {
port = mmPort;
}

View File

@@ -1,4 +1,4 @@
/* global vendor, MM, Module */
/* global Module, vendor */
/* Magic Mirror
* Module and File loaders.

View File

@@ -1,4 +1,4 @@
/* global Loader, Module, defaults */
/* global Loader, Module, defaults, Translator */
/* Magic Mirror
* Main System

View File

@@ -1,4 +1,4 @@
/* exported Module */
/* global Class, Loader, MMSocket, nunjucks, Translator */
/* Magic Mirror
* Module Blueprint.
@@ -6,7 +6,6 @@
* By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed.
*/
var Module = Class.extend({
/*********************************************************
@@ -237,7 +236,7 @@ var Module = Class.extend({
*/
socket: function () {
if (typeof this._socket === "undefined") {
this._socket = this._socket = new MMSocket(this.name);
this._socket = new MMSocket(this.name);
}
var self = this;
@@ -467,8 +466,8 @@ function cmpVersions(a, b) {
Module.register = function (name, moduleDefinition) {
if (moduleDefinition.requiresVersion) {
Log.log("Check MagicMirror version for module '" + name + "' - Minimum version: " + moduleDefinition.requiresVersion + " - Current version: " + version);
if (cmpVersions(version, moduleDefinition.requiresVersion) >= 0) {
Log.log("Check MagicMirror version for module '" + name + "' - Minimum version: " + moduleDefinition.requiresVersion + " - Current version: " + global.version);
if (cmpVersions(global.version, moduleDefinition.requiresVersion) >= 0) {
Log.log("Version is ok!");
} else {
Log.log("Version is incorrect. Skip module: '" + name + "'");

View File

@@ -4,12 +4,10 @@
* By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed.
*/
const Class = require("./class.js");
const express = require("express");
var Class = require("./class.js");
var express = require("express");
var path = require("path");
NodeHelper = Class.extend({
var NodeHelper = Class.extend({
init: function() {
console.log("Initializing new module helper ...");
},
@@ -114,7 +112,6 @@ NodeHelper = Class.extend({
}
});
});
}
});
@@ -122,4 +119,5 @@ NodeHelper.create = function(moduleDefinition) {
return NodeHelper.extend(moduleDefinition);
};
module.exports = NodeHelper;
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = NodeHelper;}

View File

@@ -71,7 +71,7 @@ var Server = function(config, callback) {
var html = fs.readFileSync(path.resolve(global.root_path + "/index.html"), {encoding: "utf8"});
html = html.replace("#VERSION#", global.version);
configFile = "config/config.js";
var configFile = "config/config.js";
if (typeof(global.configuration_file) !== "undefined") {
configFile = global.configuration_file;
}

View File

@@ -1,10 +1,11 @@
/* global io */
/* Magic Mirror
* Socket Connection
*
* By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed.
*/
var MMSocket = function(moduleName) {
var self = this;

View File

@@ -1,3 +1,11 @@
/* global io */
/* Magic Mirror
* TODO add description
*
* By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed.
*/
var MMSocket = function(moduleName) {
var self = this;