浏览代码

Loading a new file only causes a statechange event once the whole file has loaded

n1474335 7 年之前
父节点
当前提交
f7f07f2cb5
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      src/web/InputWaiter.js

+ 5 - 4
src/web/InputWaiter.js

@@ -58,13 +58,14 @@ InputWaiter.prototype.get = function() {
  * @fires Manager#statechange
  */
 InputWaiter.prototype.set = function(input) {
+    const inputText = document.getElementById("input-text");
     if (input instanceof File) {
         this.setFile(input);
-        input = "";
+        inputText.value = "";
+    } else {
+        inputText.value = input;
+        window.dispatchEvent(this.manager.statechange);
     }
-
-    document.getElementById("input-text").value = input;
-    window.dispatchEvent(this.manager.statechange);
 };