diff --git a/src/app.js b/src/app.js index 6e29c7ed52..77890695d6 100644 --- a/src/app.js +++ b/src/app.js @@ -201,10 +201,10 @@ function run () { if (provider && provider.exists(url)) { return provider.get(url, cb) } - handleImports.import(url, + handleImports.import(url, (loadingMsg) => { $('#output').append($('
').append($('').text(loadingMsg))) - } + }, (error, content, cleanUrl, type, url) => { if (!error) { filesProviders[type].addReadOnly(cleanUrl, content, url) diff --git a/src/app/compiler/compiler-imports.js b/src/app/compiler/compiler-imports.js index 65d0e77eb3..6f4b4452c5 100644 --- a/src/app/compiler/compiler-imports.js +++ b/src/app/compiler/compiler-imports.js @@ -6,22 +6,23 @@ var request = require('request') module.exports = { handleGithubCall: function (root, path, cb) { return request.get( - { - url: 'https://api.github.com/repos/' + root + '/contents/' + path, - json: true, - headers: { - 'User-Agent': 'Remix' - } - }, (err, r, data) => { - if (err) { - return cb(err || 'Unknown transport error') - } - if ('content' in data) { - cb(null, base64.decode(data.content), root + '/' + path) - } else { - cb('Content not received') - } - }); + { + url: 'https://api.github.com/repos/' + root + '/contents/' + path, + json: true, + headers: { + 'User-Agent': 'Remix' + } + }, + (err, r, data) => { + if (err) { + return cb(err || 'Unknown transport error') + } + if ('content' in data) { + cb(null, base64.decode(data.content), root + '/' + path) + } else { + cb('Content not received') + } + }) }, handleSwarmImport: function (url, cb) { @@ -35,17 +36,18 @@ module.exports = { url = url.replace(/^ipfs:\/\/?/, 'ipfs/') return request.get( - { - url: 'https://gateway.ipfs.io/' + url, - headers: { - 'User-Agent': 'Remix' - } - }, (err, r, data) => { - if (err) { - return cb(err || 'Unknown transport error') - } - cb(null, data, url) - }) + { + url: 'https://gateway.ipfs.io/' + url, + headers: { + 'User-Agent': 'Remix' + } + }, + (err, r, data) => { + if (err) { + return cb(err || 'Unknown transport error') + } + cb(null, data, url) + }) }, handlers: function () {