From 51b141ecb6b473dd4fd8425ca08f8dbc590a01c0 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 14 Dec 2016 11:41:51 +0000 Subject: Let apps override emscripten settings Read settings from OLM_OPTIONS to allow apps to configure some options. In particular, this is useful for setting the heap size. --- javascript/olm_pre.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'javascript') diff --git a/javascript/olm_pre.js b/javascript/olm_pre.js index 611488b..ae7aba5 100644 --- a/javascript/olm_pre.js +++ b/javascript/olm_pre.js @@ -21,5 +21,13 @@ if (typeof(window) !== 'undefined') { } (function() { - var module; // Shadow the Node 'module' object so that emscripten won't try - // to fiddle with it. + /* applications should define OLM_OPTIONS in the environment to override + * emscripten module settings */ + var Module = {}; + if (typeof(OLM_OPTIONS) !== 'undefined') { + for (var key in OLM_OPTIONS) { + if (OLM_OPTIONS.hasOwnProperty(key)) { + Module[key] = OLM_OPTIONS[key]; + } + } + } -- cgit v1.2.3