Last active
December 16, 2015 01:59
-
-
Save bmatusiak/5358707 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Compatibility layer for Webkit based browsers. | |
* @private | |
*/ | |
apf.runWebkit = function(){ | |
if (XMLHttpRequest.prototype.sendAsBinary === undefined) { | |
if (window.ArrayBuffer) { | |
/** | |
* Binary support for Chrome 7+ which implements [ECMA-262] typed arrays | |
* | |
* For more information, see <http://www.khronos.org/registry/typedarray/specs/latest/>. | |
*/ | |
XMLHttpRequest.prototype.sendAsBinary = function(string) { | |
var bytes = Array.prototype.map.call(string, function(c) { | |
return c.charCodeAt(0) & 0xff; | |
}); | |
this.send(new Uint8Array(bytes)); | |
}; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Compatibility layer for Webkit based browsers. | |
* @private | |
*/ | |
apf.runWebkit = function(){ | |
if (XMLHttpRequest.prototype.sendAsBinary === undefined) { | |
if (window.ArrayBuffer) { | |
/** | |
* Binary support for Chrome 7+ which implements [ECMA-262] typed arrays | |
* | |
* For more information, see <http://www.khronos.org/registry/typedarray/specs/latest/>. | |
*/ | |
XMLHttpRequest.prototype.sendAsBinary = function(string) { | |
var bytes = Array.prototype.map.call(string, function(c) { | |
return c.charCodeAt(0) & 0xff; | |
}); | |
this.send(new Uint8Array(bytes).buffer); | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/bmatusiak/5358707#file-what-there-now-js-L21 has buffer
and need to be removed