do not pollute the global object
This commit is contained in:
parent
add885c874
commit
6611165bff
2 changed files with 7 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
var Olm = (function() {
|
||||||
var olm_exports = {};
|
var olm_exports = {};
|
||||||
var onInitSuccess;
|
var onInitSuccess;
|
||||||
var onInitFail;
|
var onInitFail;
|
||||||
|
|
|
@ -17,16 +17,20 @@ olm_exports['init'] = function(opts) {
|
||||||
return olmInitPromise;
|
return olmInitPromise;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return olm_exports;
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
if (typeof(window) !== 'undefined') {
|
if (typeof(window) !== 'undefined') {
|
||||||
// We've been imported directly into a browser. Define the global 'Olm' object.
|
// We've been imported directly into a browser. Define the global 'Olm' object.
|
||||||
// (we do this even if module.exports was defined, because it's useful to have
|
// (we do this even if module.exports was defined, because it's useful to have
|
||||||
// Olm in the global scope for browserified and webpacked apps.)
|
// Olm in the global scope for browserified and webpacked apps.)
|
||||||
window["Olm"] = olm_exports;
|
window["Olm"] = Olm;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof module === 'object') {
|
if (typeof module === 'object') {
|
||||||
// Emscripten sets the module exports to be its module
|
// Emscripten sets the module exports to be its module
|
||||||
// with wrapped c functions. Clobber it with our higher
|
// with wrapped c functions. Clobber it with our higher
|
||||||
// level wrapper class.
|
// level wrapper class.
|
||||||
module.exports = olm_exports;
|
module.exports = Olm;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue