- 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");
module.exports = NodeHelper.create({
start: function () {
},
start: function () {
},
socketNotificationReceived: function (notification, payload) {
var self = this;
socketNotificationReceived: function (notification, payload) {
var self = this;
if (notification === "AUTO_LOCATION") {
console.log("Loading timezone...");
http.get("http://ip-api.com/json", function (req) {
var data = "";
req.on("data", function (d) {
data += d;
});
req.on("end", function () {
var body = JSON.parse(data);
payload.location = body.city + ", " + body.regionName;
self.sendSocketNotification("UPDATE_LOCATION", payload);
});
}).on("error", function () {
payload.error = "Could not figure out the timezone.";
self.sendSocketNotification("UPDATE_LOCATION", payload);
});
console.log("Loading timezone...");
http.get("http://ip-api.com/json", function (req) {
var data = "";
req.on("data", function (d) {
data += d;
});
req.on("end", function () {
var body = JSON.parse(data);
payload.location = body.city + ", " + body.regionName;
self.sendSocketNotification("UPDATE_LOCATION", payload);
});
}).on("error", function () {
payload.error = "Could not figure out the timezone.";
self.sendSocketNotification("UPDATE_LOCATION", payload);
});
}
}
});

View File

@ -2,28 +2,28 @@ var http = require("http");
var NodeHelper = require("node_helper");
module.exports = NodeHelper.create({
start: function () {
},
start: function () {
},
socketNotificationReceived: function (notification, payload) {
var self = this;
socketNotificationReceived: function (notification, payload) {
var self = this;
if (notification === "AUTO_LOCATION") {
console.log("Loading timezone...");
http.get("http://ip-api.com/json", function (req) {
var data = "";
req.on("data", function (d) {
data += d;
});
req.on("end", function () {
var body = JSON.parse(data);
payload.location = body.city + ", " + body.regionName;
self.sendSocketNotification("UPDATE_LOCATION", payload);
});
}).on("error", function () {
payload.error = "Could not figure out the timezone.";
self.sendSocketNotification("UPDATE_LOCATION", payload);
});
console.log("Loading timezone...");
http.get("http://ip-api.com/json", function (req) {
var data = "";
req.on("data", function (d) {
data += d;
});
req.on("end", function () {
var body = JSON.parse(data);
payload.location = body.city + ", " + body.regionName;
self.sendSocketNotification("UPDATE_LOCATION", payload);
});
}).on("error", function () {
payload.error = "Could not figure out the timezone.";
self.sendSocketNotification("UPDATE_LOCATION", payload);
});
}
}
});