Add more workarounds for closure compiler in javascript bindings

logging_enabled
Mark Haines 2015-07-21 14:30:46 +01:00
parent bb70307b11
commit 5a60e543a5
1 changed files with 3 additions and 3 deletions

View File

@ -2,10 +2,10 @@ var olm_exports = {};
var get_random_values; var get_random_values;
var process; // Shadow the process object so that emscripten won't get var process; // Shadow the process object so that emscripten won't get
// confused by browserify // confused by browserify
if (global && global.window) { if (global && global["window"]) {
// We're running with browserify // We're running with browserify
module["exports"] = olm_exports; module["exports"] = olm_exports;
global.window["Olm"] = olm_exports; global["window"]["Olm"] = olm_exports;
get_random_values = function(buf) { get_random_values = function(buf) {
window.crypto.getRandomValues(buf); window.crypto.getRandomValues(buf);
}; };
@ -23,7 +23,7 @@ if (global && global.window) {
var bytes = nodeCrypto.randomBytes(buf.length); var bytes = nodeCrypto.randomBytes(buf.length);
buf.set(bytes); buf.set(bytes);
} }
process = global.process; process = global["process"];
} else { } else {
throw new Error("Cannot find global to attach library to"); throw new Error("Cannot find global to attach library to");
} }