Merge pull request #269 from dconnolly/mscrypto

If browser `crypto` is not available, try `msCrypto` before assuming a Node environment.
This commit is contained in:
Frank Denis 2015-06-09 00:49:51 +02:00
commit b2dd3453d5

View File

@ -60,7 +60,8 @@ randombytes_stir(void)
EM_ASM({
if (Module.getRandomValue === undefined) {
try {
var crypto_ = ("object" === typeof window ? window : self).crypto,
var window_ = "object" === typeof window ? window : self,
crypto_ = typeof window_.crypto !== "undefined" ? window_.crypto : window_.msCrypto,
randomValuesStandard = function() {
var buf = new Uint32Array(1);
crypto_.getRandomValues(buf);