From 6e58fdc0bb60e33081f75a97bd1669776acbf579 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Mon, 4 May 2015 19:53:13 +0200 Subject: Fix the calling of load_contents_async. --- iss_get_data.js | 8 ++------ 1 file 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); }); } -- cgit