@ethersproject/shims
Advanced tools
Comparing version
@@ -17,3 +17,3 @@ { | ||
], | ||
"gitHead": "211defa27f85af111e81b400a18922f35dff21e1", | ||
"gitHead": "6c43e20e7a68f3f5a141c74527ec63d9fe8458be", | ||
"keywords": [ | ||
@@ -37,5 +37,5 @@ "Ethereum", | ||
}, | ||
"tarballHash": "0x533d308926d3d1946b4d41c8902cc203cc06ac205f1b4df68314fb0402a5b50d", | ||
"tarballHash": "0x3a0ffcff03da2a955e81177cb4edd1677cb42156c95ef5961a83a7da93814ac6", | ||
"types": "./lib/index.d.ts", | ||
"version": "5.0.10" | ||
"version": "5.0.11" | ||
} |
@@ -88,23 +88,21 @@ 'use strict'; | ||
fr.readAsArrayBuffer(new Blob([ "hello" ], { type: "text/plain" })); | ||
return; | ||
} catch (error) { } | ||
shims.push("FileReader.prototype.readAsArrayBuffer"); | ||
FileReader.prototype.readAsArrayBuffer = function (blob) { | ||
if (this.readyState === this.LOADING) throw new Error("InvalidStateError"); | ||
this._setReadyState(this.LOADING); | ||
this._result = null; | ||
this._error = null; | ||
var fr = new FileReader(); | ||
fr.onloadend = () => { | ||
var content = atob(fr.result.split(",").pop().trim()); | ||
var buffer = new ArrayBuffer(content.length); | ||
var view = new Uint8Array(buffer); | ||
view.set(Array.from(content).map(c => c.charCodeAt(0))); | ||
this._result = buffer; | ||
this._setReadyState(this.DONE); | ||
}; | ||
fr.readAsDataURL(blob); | ||
} catch (error) { | ||
shims.push("FileReader.prototype.readAsArrayBuffer"); | ||
FileReader.prototype.readAsArrayBuffer = function (blob) { | ||
if (this.readyState === this.LOADING) { throw new Error("InvalidStateError"); } | ||
this._setReadyState(this.LOADING); | ||
this._result = null; | ||
this._error = null; | ||
var fr = new FileReader(); | ||
fr.onloadend = () => { | ||
var content = atob(fr.result.split(",").pop().trim()); | ||
var buffer = new ArrayBuffer(content.length); | ||
var view = new Uint8Array(buffer); | ||
view.set(Array.from(content).map(c => c.charCodeAt(0))); | ||
this._result = buffer; | ||
this._setReadyState(this.DONE); | ||
}; | ||
fr.readAsDataURL(blob); | ||
} | ||
} | ||
} catch (error) { | ||
@@ -111,0 +109,0 @@ console.log("Missing FileReader; unsupported platform"); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
450471
0.02%