mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-01 13:33:15 +00:00
- Converted indentation to tabs.
This commit is contained in:
parent
5ca3fbeaea
commit
1a97107b2d
@ -2,28 +2,28 @@ var http = require("http");
|
|||||||
var NodeHelper = require("node_helper");
|
var NodeHelper = require("node_helper");
|
||||||
|
|
||||||
module.exports = NodeHelper.create({
|
module.exports = NodeHelper.create({
|
||||||
start: function () {
|
start: function () {
|
||||||
},
|
},
|
||||||
|
|
||||||
socketNotificationReceived: function (notification, payload) {
|
socketNotificationReceived: function (notification, payload) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if (notification === "AUTO_LOCATION") {
|
if (notification === "AUTO_LOCATION") {
|
||||||
console.log("Loading timezone...");
|
console.log("Loading timezone...");
|
||||||
http.get("http://ip-api.com/json", function (req) {
|
http.get("http://ip-api.com/json", function (req) {
|
||||||
var data = "";
|
var data = "";
|
||||||
req.on("data", function (d) {
|
req.on("data", function (d) {
|
||||||
data += d;
|
data += d;
|
||||||
});
|
});
|
||||||
req.on("end", function () {
|
req.on("end", function () {
|
||||||
var body = JSON.parse(data);
|
var body = JSON.parse(data);
|
||||||
payload.location = body.city + ", " + body.regionName;
|
payload.location = body.city + ", " + body.regionName;
|
||||||
self.sendSocketNotification("UPDATE_LOCATION", payload);
|
self.sendSocketNotification("UPDATE_LOCATION", payload);
|
||||||
});
|
});
|
||||||
}).on("error", function () {
|
}).on("error", function () {
|
||||||
payload.error = "Could not figure out the timezone.";
|
payload.error = "Could not figure out the timezone.";
|
||||||
self.sendSocketNotification("UPDATE_LOCATION", payload);
|
self.sendSocketNotification("UPDATE_LOCATION", payload);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2,28 +2,28 @@ var http = require("http");
|
|||||||
var NodeHelper = require("node_helper");
|
var NodeHelper = require("node_helper");
|
||||||
|
|
||||||
module.exports = NodeHelper.create({
|
module.exports = NodeHelper.create({
|
||||||
start: function () {
|
start: function () {
|
||||||
},
|
},
|
||||||
|
|
||||||
socketNotificationReceived: function (notification, payload) {
|
socketNotificationReceived: function (notification, payload) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if (notification === "AUTO_LOCATION") {
|
if (notification === "AUTO_LOCATION") {
|
||||||
console.log("Loading timezone...");
|
console.log("Loading timezone...");
|
||||||
http.get("http://ip-api.com/json", function (req) {
|
http.get("http://ip-api.com/json", function (req) {
|
||||||
var data = "";
|
var data = "";
|
||||||
req.on("data", function (d) {
|
req.on("data", function (d) {
|
||||||
data += d;
|
data += d;
|
||||||
});
|
});
|
||||||
req.on("end", function () {
|
req.on("end", function () {
|
||||||
var body = JSON.parse(data);
|
var body = JSON.parse(data);
|
||||||
payload.location = body.city + ", " + body.regionName;
|
payload.location = body.city + ", " + body.regionName;
|
||||||
self.sendSocketNotification("UPDATE_LOCATION", payload);
|
self.sendSocketNotification("UPDATE_LOCATION", payload);
|
||||||
});
|
});
|
||||||
}).on("error", function () {
|
}).on("error", function () {
|
||||||
payload.error = "Could not figure out the timezone.";
|
payload.error = "Could not figure out the timezone.";
|
||||||
self.sendSocketNotification("UPDATE_LOCATION", payload);
|
self.sendSocketNotification("UPDATE_LOCATION", payload);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user