Skip to content

Commit ba4eeb3

Browse files
dcodeIOkripken
authored andcommitted
Use Emscripten's MODULARIZE_INSTANCE when building binaryen.js (#1368)
1 parent 9bde263 commit ba4eeb3

File tree

5 files changed

+239
-227
lines changed

5 files changed

+239
-227
lines changed

bin/binaryen.js

Lines changed: 202 additions & 176 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/wasm.js

Lines changed: 35 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-js.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,5 +586,6 @@ export_function "_BinaryenSetAPITracing"
586586
-Isrc/ \
587587
-s EXPORTED_FUNCTIONS=[${EXPORTED_FUNCTIONS}] \
588588
-o bin/binaryen${OUT_FILE_SUFFIX}.js \
589-
--pre-js src/js/binaryen.js-pre.js \
589+
-s MODULARIZE_INSTANCE=1 \
590+
-s 'EXPORT_NAME="Binaryen"' \
590591
--post-js src/js/binaryen.js-post.js

src/js/binaryen.js-post.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,19 +1563,3 @@ Module['setDebugInfo'] = function(on) {
15631563
Module['setAPITracing'] = function(on) {
15641564
return Module['_BinaryenSetAPITracing'](on);
15651565
};
1566-
1567-
// Instantiates a new unique instance of the API with its own memory etc.
1568-
Module['instantiate'] = instantiate;
1569-
return Module;
1570-
1571-
} // end of instantiate
1572-
1573-
// Module loader code borrowed from webpack
1574-
if (typeof exports === 'object' && typeof module === 'object')
1575-
module.exports = instantiate();
1576-
else if (typeof define === 'function' && define['amd'])
1577-
define([], instantiate);
1578-
else if (typeof exports === 'object')
1579-
exports['Binaryen'] = instantiate();
1580-
else
1581-
(typeof self !== "undefined" ? self : this)['Binaryen'] = instantiate();

src/js/binaryen.js-pre.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)