This is an automated email from the ASF dual-hosted git repository.

erikdebruin pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 3dc37ce  Add ‘glue’ utility script to allow WASM to be loaded in HTML
3dc37ce is described below

commit 3dc37ceb90c20be37639068061dba14b79e9461b
Author: Erik de Bruin <e...@ixsoftware.nl>
AuthorDate: Tue Nov 14 16:54:13 2017 +0100

    Add ‘glue’ utility script to allow WASM to be loaded in HTML
    
    Signed-off-by: Erik de Bruin <e...@ixsoftware.nl>
---
 .gitignore             |  3 +++
 wast/resources/glue.js | 11 +++++++++++
 2 files changed, 14 insertions(+)

diff --git a/.gitignore b/.gitignore
index a32c5ce..64c80a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -141,3 +141,6 @@ vf2js/frameworks/js/
 #FlexJS generated files
 frameworks/js/FlexJS/generated-sources
 manualtests/FlexJSTest_SVG/bin
+
+#WAST generated files
+/wast/examples/HelloWorld/bin
diff --git a/wast/resources/glue.js b/wast/resources/glue.js
new file mode 100644
index 0000000..fe66877
--- /dev/null
+++ b/wast/resources/glue.js
@@ -0,0 +1,11 @@
+function fetchAndInstantiate(url, importObject) {
+  return fetch(url).then(response =>
+    response.arrayBuffer()
+  )
+  .then(bytes =>
+    WebAssembly.instantiate(bytes, importObject)
+  )
+  .then(results =>
+    results.instance
+  );
+}

-- 
To stop receiving notification emails like this one, please contact
['"commits@royale.apache.org" <commits@royale.apache.org>'].

Reply via email to