Commit 095974e6 authored by Denton Liu's avatar Denton Liu

Make uploadFile have a callback

This should fix #80.
parent 76aa0228
......@@ -163,8 +163,9 @@ var run = function () {
for (var i = 0; i < fileList.length; i++) {
var name = fileList[i].name;
if (!window.localStorage[utils.fileKey(name)] || confirm('The file ' + name + ' already exists! Would you like to overwrite it?')) {
editor.uploadFile(fileList[i]);
editor.uploadFile(fileList[i], function () {
updateFiles();
});
}
}
......
......@@ -16,13 +16,14 @@ function Editor (loadingFromGist) {
this.setCacheFileContent('');
};
this.uploadFile = function (file) {
this.uploadFile = function (file, callback) {
var fileReader = new FileReader();
SOL_CACHE_FILE = utils.fileKey(file.name);
fileReader.onload = function (e) {
window.localStorage[SOL_CACHE_FILE] = e.target.result;
sessions[SOL_CACHE_FILE] = null;
callback();
};
fileReader.readAsText(file);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment