Lazy init file input's FileReader

This commit is contained in:
lilia 2015-03-02 18:01:59 -08:00
parent c8274d7bc7
commit 6fe262ceed

View file

@ -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]);
}