I write a module:
window.FileReader = (function () {
var read = function (file) {
var reader = new FileReader();
reader.onload = function (e) {
console.log(e.target);
};
// reader.readAsDataURL(file);
};
return {
read: read
};
})();
but when I execute
FileReader.read()
it always warn me object is not function at var reader = new FileReader()
what's wrong with my code?