move loading message display to the caller of the compiler

pull/1/head
Iuri Matias 7 years ago
parent 1cb05f7d34
commit 088b11b41f
  1. 18
      src/app.js
  2. 5
      src/app/compiler/compiler-imports.js

@ -201,14 +201,18 @@ function run () {
if (provider && provider.exists(url)) {
return provider.get(url, cb)
}
handleImports.import(url, (error, content, cleanUrl, type, url) => {
if (!error) {
filesProviders[type].addReadOnly(cleanUrl, content, url)
cb(null, content)
} else {
cb(error)
handleImports.import(url,
(loadingMsg) => {
$('#output').append($('<div/>').append($('<pre/>').text(loadingMsg)))
}
})
(error, content, cleanUrl, type, url) => {
if (!error) {
filesProviders[type].addReadOnly(cleanUrl, content, url)
cb(null, content)
} else {
cb(error)
}
})
})
var offsetToLineColumnConverter = new OffsetToLineColumnConverter(compiler.event)

@ -48,7 +48,7 @@ module.exports = {
]
},
import: function (url, cb) {
import: function (url, loadingCb, cb) {
var handlers = this.handlers()
var found = false
@ -61,8 +61,7 @@ module.exports = {
if (match) {
found = true
// TODO: this needs to be moved to the caller
$('#output').append($('<div/>').append($('<pre/>').text('Loading ' + url + ' ...')))
loadingCb('Loading ' + url + ' ...')
handler.handler(match, function (err, content, cleanUrl) {
if (err) {
cb('Unable to import "' + cleanUrl + '": ' + err)

Loading…
Cancel
Save