Skip to content

Commit

Permalink
fix(File): fixed readFileAs (#479)
Browse files Browse the repository at this point in the history
* Fix(File): Fixing readFileAs

https://developer.mozilla.org/de/docs/Web/API/FileReader --> FileReader expects File and not FileEntry.

* Fix(File): Fixing readFileAs

refactoring to arrow Functions
  • Loading branch information
DrGanmon authored and ihadeed committed Aug 26, 2016
1 parent 8526e89 commit eff7841
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions src/plugins/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,10 @@ export interface FileReader {
onabort: (evt: ProgressEvent) => void;

abort(): void;
readAsText(fe: FileEntry, encoding?: string): void;
readAsDataURL(fe: FileEntry): void;
readAsBinaryString(fe: FileEntry): void;
readAsArrayBuffer(fe: FileEntry): void;
readAsText(fe: File, encoding?: string): void;
readAsDataURL(fe: File): void;
readAsBinaryString(fe: File): void;
readAsArrayBuffer(fe: File): void;
}

declare var FileReader: {
Expand Down Expand Up @@ -752,8 +752,12 @@ export class File {
reject({code: null, message: 'READER_ONLOADEND_ERR'});
}
};
fe.file(file => {
reader.readAsText(file);
}, error => {
reject(error);
})

reader.readAsText(fe);
});
});
}
Expand Down Expand Up @@ -790,7 +794,13 @@ export class File {
}
};

reader.readAsDataURL(fe);


fe.file(file => {
reader.readAsDataURL(file);
}, error => {
reject(error);
})
});
});
}
Expand Down Expand Up @@ -826,7 +836,12 @@ export class File {
}
};

reader.readAsBinaryString(fe);
fe.file(file => {
reader.readAsBinaryString(file);
}, error => {
reject(error);
})

});
});
}
Expand Down Expand Up @@ -862,7 +877,12 @@ export class File {
}
};

reader.readAsArrayBuffer(fe);
fe.file(file => {
reader.readAsArrayBuffer(file);
}, error => {
reject(error);
})

});
});
}
Expand Down

0 comments on commit eff7841

Please sign in to comment.