diff options
author | Marcus Better <marcusb@users.noreply.github.com> | 2022-12-27 10:57:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-27 07:57:42 -0800 |
commit | aefa094ea44619a410218ab754c6b58ac3a49683 (patch) | |
tree | 0fd79486487d803139e387e1a660a0189a9e3a91 /docs/demo/wat2wasm/demo.js | |
parent | d9338f70a26cc9ee4e64da71ce3b50d4c44e0c03 (diff) | |
download | wabt-aefa094ea44619a410218ab754c6b58ac3a49683.tar.gz wabt-aefa094ea44619a410218ab754c6b58ac3a49683.tar.bz2 wabt-aefa094ea44619a410218ab754c6b58ac3a49683.zip |
Enable features in libwabt.js by default (#2109)
This applies the same defaults for features in the JavaScript-compiled
version as the native tools. Without this change, enabling only the
"reference_types" feature did not work, as it got turned off due to
the dependency on "bulk_memory", which is counter-intuitive (see
Features::UpdateDependencies()).
Additionally, exposes all the features and their default setting in
JavaScript.
Diffstat (limited to 'docs/demo/wat2wasm/demo.js')
-rw-r--r-- | docs/demo/wat2wasm/demo.js | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/docs/demo/wat2wasm/demo.js b/docs/demo/wat2wasm/demo.js index 66f44736..a5b7eb09 100644 --- a/docs/demo/wat2wasm/demo.js +++ b/docs/demo/wat2wasm/demo.js @@ -24,19 +24,6 @@ var features = {}; WabtModule().then(function(wabt) { -var FEATURES = [ - 'exceptions', - 'mutable_globals', - 'sat_float_to_int', - 'sign_extension', - 'simd', - 'threads', - 'multi_value', - 'tail_call', - 'bulk_memory', - 'reference_types', -]; - var kCompileMinMS = 100; var outputShowBase64 = false; var outputLog; @@ -52,9 +39,9 @@ var base64El = document.getElementById('base64'); var binaryBuffer = null; var binaryBlobUrl = null; -for (var feature of FEATURES) { - var featureEl = document.getElementById(feature); - features[feature] = featureEl.checked; +for (const [f, v] of Object.entries(wabt.FEATURES)) { + var featureEl = document.getElementById(f); + featureEl.checked = v; featureEl.addEventListener('change', event => { var feature = event.target.id; features[feature] = event.target.checked; |