From 6fe262ceed7ceb09b5dc5358c7be75f6261dc001 Mon Sep 17 00:00:00 2001 From: lilia Date: Mon, 2 Mar 2015 18:01:59 -0800 Subject: [PATCH] Lazy init file input's FileReader --- js/views/file_input_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/views/file_input_view.js b/js/views/file_input_view.js index db6268d4..d34a2c7e 100644 --- a/js/views/file_input_view.js +++ b/js/views/file_input_view.js @@ -50,7 +50,6 @@ var Whisper = Whisper || {}; this.clearForm(); var files = this.$input.prop('files'); for (var i = 0; i < files.length; i++) { - var FR = new FileReader(); var limitKb = 1000000; switch (files[i].type.split('/')[0]) { case 'image': limitKb = 420; break; @@ -64,6 +63,7 @@ var Whisper = Whisper || {}; this.deleteFiles(); } else { + var FR = new FileReader(); FR.onload = this.addThumb.bind(this); FR.readAsDataURL(files[i]); }