diff options
-rw-r--r-- | iss_get_data.js | 8 |
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); }); } |