- Converted indentation to tabs.

This commit is contained in:
Jacob Ebey 2019-02-09 12:49:47 -08:00
parent 5ca3fbeaea
commit 1a97107b2d
2 changed files with 38 additions and 38 deletions

View File

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

View File

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