From f5dc22e49d4610dfd01b09b1ed160e5a5d22ae1f Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 4 May 2015 12:04:04 -0700 Subject: [PATCH] Fix filereader feature check --- test/test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/test.js b/test/test.js index 85a04f95..0d89b253 100644 --- a/test/test.js +++ b/test/test.js @@ -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() { @@ -10,7 +10,7 @@ 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') @@ -18,7 +18,7 @@ function readBlobAsText(blob) { } function readBlobAsBytes(blob) { - if (typeof FileReader === 'function') { + if ('FileReader' in self) { return new Promise(function(resolve, reject) { var reader = new FileReader() reader.onload = function() { @@ -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')