mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
Standardize: TO JSCS!
This commit is contained in:
31
js/module.js
31
js/module.js
@@ -28,7 +28,7 @@ var Module = Class.extend({
|
||||
* Is called when the module is started.
|
||||
*/
|
||||
start: function() {
|
||||
Log.info('Starting module: ' + this.name);
|
||||
Log.info("Starting module: " + this.name);
|
||||
},
|
||||
|
||||
/* getScripts()
|
||||
@@ -82,9 +82,9 @@ var Module = Class.extend({
|
||||
*/
|
||||
notificationReceived: function(notification, payload, sender) {
|
||||
if (sender) {
|
||||
Log.log(this.name + ' received a module notification: ' + notification + ' from sender: ' + sender.name);
|
||||
Log.log(this.name + " received a module notification: " + notification + " from sender: " + sender.name);
|
||||
} else {
|
||||
Log.log(this.name + ' received a system notification: ' + notification);
|
||||
Log.log(this.name + " received a system notification: " + notification);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -95,10 +95,9 @@ var Module = Class.extend({
|
||||
* argument payload mixed - The payload of the notification.
|
||||
*/
|
||||
socketNotificationReceived: function(notification, payload) {
|
||||
Log.log(this.name + ' received a socket notification: ' + notification + ' - Payload: ' + payload);
|
||||
Log.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload);
|
||||
},
|
||||
|
||||
|
||||
/*********************************************
|
||||
* The methods below don't need subclassing. *
|
||||
*********************************************/
|
||||
@@ -131,7 +130,7 @@ var Module = Class.extend({
|
||||
* It also registers the notification callback.
|
||||
*/
|
||||
socket: function() {
|
||||
if (typeof this._socket === 'undefined') {
|
||||
if (typeof this._socket === "undefined") {
|
||||
this._socket = this._socket = new MMSocket(this.name);
|
||||
}
|
||||
|
||||
@@ -151,7 +150,7 @@ var Module = Class.extend({
|
||||
* return string - File path.
|
||||
*/
|
||||
file: function(file) {
|
||||
return this.data.path + '/' + file;
|
||||
return this.data.path + "/" + file;
|
||||
},
|
||||
|
||||
/* loadStyles()
|
||||
@@ -258,16 +257,16 @@ Module.create = function(name) {
|
||||
|
||||
//Define the clone method for later use.
|
||||
function cloneObject(obj) {
|
||||
if (obj === null || typeof obj !== 'object') {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || typeof obj !== "object") {
|
||||
return obj;
|
||||
}
|
||||
|
||||
var temp = obj.constructor(); // give temp the original obj's constructor
|
||||
for (var key in obj) {
|
||||
temp[key] = cloneObject(obj[key]);
|
||||
}
|
||||
var temp = obj.constructor(); // give temp the original obj's constructor
|
||||
for (var key in obj) {
|
||||
temp[key] = cloneObject(obj[key]);
|
||||
}
|
||||
|
||||
return temp;
|
||||
return temp;
|
||||
}
|
||||
|
||||
var moduleDefinition = Module.definitions[name];
|
||||
@@ -281,6 +280,6 @@ Module.create = function(name) {
|
||||
};
|
||||
|
||||
Module.register = function(name, moduleDefinition) {
|
||||
Log.log('Module registered: ' + name);
|
||||
Log.log("Module registered: " + name);
|
||||
Module.definitions[name] = moduleDefinition;
|
||||
};
|
||||
|
Reference in New Issue
Block a user