Skip to content

Commit

Permalink
Fix filereader feature check
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed May 4, 2015
1 parent 468b8cb commit f5dc22e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function readBlobAsText(blob) {
if (typeof FileReader === 'function') {
if ('FileReader' in self) {
return new Promise(function(resolve, reject) {
var reader = new FileReader()
reader.onload = function() {
Expand All @@ -10,15 +10,15 @@ function readBlobAsText(blob) {
}
reader.readAsText(blob)
})
} else if (typeof FileReaderSync === 'function') {
} else if ('FileReaderSync' in self) {
return new FileReaderSync().readAsText(blob)
} else {
throw new ReferenceError('FileReader is not defined')
}
}

function readBlobAsBytes(blob) {
if (typeof FileReader === 'function') {
if ('FileReader' in self) {
return new Promise(function(resolve, reject) {
var reader = new FileReader()
reader.onload = function() {
Expand All @@ -30,7 +30,7 @@ function readBlobAsBytes(blob) {
}
reader.readAsArrayBuffer(blob)
})
} else if (typeof FileReaderSync === 'function') {
} else if ('FileReaderSync' in self) {
return new FileReaderSync().readAsArrayBuffer(blob)
} else {
throw new ReferenceError('FileReader is not defined')
Expand Down

0 comments on commit f5dc22e

Please sign in to comment.