diff --git a/index.js b/index.js index 53eaf0b..9168826 100644 --- a/index.js +++ b/index.js @@ -2,10 +2,11 @@ * Create a blob builder even when vendor prefixes exist */ -var BlobBuilder = global.BlobBuilder - || global.WebKitBlobBuilder - || global.MSBlobBuilder - || global.MozBlobBuilder; +var BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder : + typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder : + typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder : + typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : + false; /** * Check if Blob constructor is supported @@ -83,14 +84,14 @@ function BlobConstructor(ary, options) { return new Blob(mapArrayBufferViews(ary), options || {}); }; -if (global.Blob) { +if (typeof Blob !== 'undefined') { BlobBuilderConstructor.prototype = Blob.prototype; BlobConstructor.prototype = Blob.prototype; } module.exports = (function() { if (blobSupported) { - return blobSupportsArrayBufferView ? global.Blob : BlobConstructor; + return blobSupportsArrayBufferView ? Blob : BlobConstructor; } else if (blobBuilderSupported) { return BlobBuilderConstructor; } else {