summaryrefslogtreecommitdiffstats
path: root/iss_get_data.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2015-05-04 19:53:13 +0200
committerMatěj Cepl <mcepl@cepl.eu>2015-05-04 19:53:13 +0200
commit6e58fdc0bb60e33081f75a97bd1669776acbf579 (patch)
tree2ec06ec6aa7b96240b71e95fa8045febfcd90a26 /iss_get_data.js
parentf3398b70d49e8146b33ff572ff7fe03d2dfa200c (diff)
downloadISS_Above-6e58fdc0bb60e33081f75a97bd1669776acbf579.tar.gz
Fix the calling of load_contents_async.
Diffstat (limited to 'iss_get_data.js')
-rw-r--r--iss_get_data.js8
1 files changed, 2 insertions, 6 deletions
diff --git a/iss_get_data.js b/iss_get_data.js
index cf97015..03c2ec5 100644
--- a/iss_get_data.js
+++ b/iss_get_data.js
@@ -53,15 +53,11 @@ const LocationProxy = Gio.DBusProxy.makeProxyWrapper(LocationInterface);
function get_ISS_coords() {
const API_URL = 'http://api.open-notify.org/iss-now.json';
- // let iss_api = Gio.file_new_for_uri(API_URL);
let iss_api = Gio.file_new_for_uri(API_URL);
- print('filename: ' + iss_api + '\n---------------');
- iss_api.load_contents_async(null, function(data) {
- print('data = ' + data);
- let iss_coords = JSON.parse(data);
+ iss_api.load_contents_async(null, function(iss_api, result) {
+ let iss_coords = JSON.parse(iss_api.load_contents_finish(result)[1]);
print(Object.keys(iss_coords));
print(iss_coords.toSource());
- iss_api.load_contents_finish(data);
});
}