remove settimeout

pull/3094/head
yann300 7 years ago
parent dbafc50195
commit 3129369dfa
  1. 4
      src/app/compiler/compiler.js
  2. 2
      src/app/files/basicReadOnlyExplorer.js
  3. 64
      src/app/files/browser-files.js

@ -49,9 +49,7 @@ function Compiler (handleImportCall) {
self.lastCompilationResult = null
self.event.trigger('compilationFinished', [false, {'error': { formattedMessage: error, severity: 'error' }}, files])
} else {
setTimeout(function () {
compileJSON(input, optimize ? 1 : 0)
}, 0)
compileJSON(input, optimize ? 1 : 0)
}
})
}

@ -108,7 +108,7 @@ class BasicReadOnlyExplorer {
'/content': self.get(path)
})
})
setTimeout(_ => callback(null, tree), 0)
callback(null, tree)
}
removePrefix (path) {

@ -118,42 +118,40 @@ function Files (storage) {
this.resolveDirectory = function (path, callback) {
var self = this
// path = '' + (path || '')
setTimeout(function () {
function hashmapize (obj, path, val) {
var nodes = path.split('/')
var i = 0
for (; i < nodes.length - 1; i++) {
var node = nodes[i]
if (obj[node] === undefined) {
obj[node] = {}
}
obj = obj[node]
function hashmapize (obj, path, val) {
var nodes = path.split('/')
var i = 0
for (; i < nodes.length - 1; i++) {
var node = nodes[i]
if (obj[node] === undefined) {
obj[node] = {}
}
obj[nodes[i]] = val
obj = obj[node]
}
var filesList = {}
// add r/w filesList to the list
storage.keys().forEach((path) => {
// NOTE: as a temporary measure do not show the config file
if (path !== '.remix.config') {
filesList[self.type + '/' + path] = false
}
})
// add r/o files to the list
Object.keys(readonly).forEach((path) => {
filesList[self.type + '/' + path] = true
})
var tree = {}
// This does not include '.remix.config', because it is filtered
// inside list().
Object.keys(filesList).forEach(function (path) {
hashmapize(tree, path, {
'/readonly': self.isReadOnly(path),
'/content': self.get(path)
})
obj[nodes[i]] = val
}
var filesList = {}
// add r/w filesList to the list
storage.keys().forEach((path) => {
// NOTE: as a temporary measure do not show the config file
if (path !== '.remix.config') {
filesList[self.type + '/' + path] = false
}
})
// add r/o files to the list
Object.keys(readonly).forEach((path) => {
filesList[self.type + '/' + path] = true
})
var tree = {}
// This does not include '.remix.config', because it is filtered
// inside list().
Object.keys(filesList).forEach(function (path) {
hashmapize(tree, path, {
'/readonly': self.isReadOnly(path),
'/content': self.get(path)
})
callback(null, tree)
}, 0)
})
callback(null, tree)
}
this.removePrefix = function (path) {

Loading…
Cancel
Save