From dc37d7b74edde1876f2114ad8edd10ab076e778f Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 24 May 2019 15:02:42 -0700 Subject: Add `getGlobal` to binaryen.js (#2142) We have `getFunction`, but not `getGlobal` because its name clashed with APIs for the deprecated instruction `get_global`. Now we have reflected instruction renaming in code, we can add it for consistency. --- src/js/binaryen.js-post.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/js/binaryen.js-post.js') diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index 6f0bec734..c64d3caca 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -1776,6 +1776,11 @@ function wrapModule(module, self) { return Module['_BinaryenAddGlobal'](module, strToStack(name), type, mutable, init); }); } + self['getGlobal'] = function(name) { + return preserveStack(function() { + return Module['_BinaryenGetGlobal'](module, strToStack(name)); + }); + }; self['removeGlobal'] = function(name) { return preserveStack(function() { return Module['_BinaryenRemoveGlobal'](module, strToStack(name)); -- cgit v1.2.3