{"action":"opened","issue":{"url":"https://api.github.com/repos/WebAssembly/binaryen/issues/1048","repository_url":"https://api.github.com/repos/WebAssembly/binaryen","labels_url":"https://api.github.com/repos/WebAssembly/binaryen/issues/1048/labels{/name}","comments_url":"https://api.github.com/repos/WebAssembly/binaryen/issues/1048/comments","events_url":"https://api.github.com/repos/WebAssembly/binaryen/issues/1048/events","html_url":"https://github.com/WebAssembly/binaryen/issues/1048","id":235003729,"number":1048,"title":"How use wasm code without import external file","user":{"login":"Gurigraphics","id":9745229,"avatar_url":"https://avatars3.githubusercontent.com/u/9745229?v=3","gravatar_id":"","url":"https://api.github.com/users/Gurigraphics","html_url":"https://github.com/Gurigraphics","followers_url":"https://api.github.com/users/Gurigraphics/followers","following_url":"https://api.github.com/users/Gurigraphics/following{/other_user}","gists_url":"https://api.github.com/users/Gurigraphics/gists{/gist_id}","starred_url":"https://api.github.com/users/Gurigraphics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gurigraphics/subscriptions","organizations_url":"https://api.github.com/users/Gurigraphics/orgs","repos_url":"https://api.github.com/users/Gurigraphics/repos","events_url":"https://api.github.com/users/Gurigraphics/events{/privacy}","received_events_url":"https://api.github.com/users/Gurigraphics/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-10T13:46:06Z","updated_at":"2017-06-10T13:46:06Z","closed_at":null,"body":"\r\n**1- How use this wasm code without import external file ('test.wasm')?** \r\n\r\n    var test = `0061 736d 0100 0000 0186 8080 8000 0160\r\n    017f 017f 0382 8080 8000 0100 0484 8080\r\n    8000 0170 0000 0583 8080 8000 0100 0106\r\n    8180 8080 0000 079e 8080 8000 0206 6d65\r\n    6d6f 7279 0200 115f 5a31 3274 6573 7446\r\n    756e 6374 696f 6e69 0000 0a8d 8080 8000\r\n    0187 8080 8000 0020 0041 0a6a 0b`;\r\n\r\n\r\n**2- How to pass parameters to an imported function out of fetch?**\r\n\r\n```\r\nvar importObject = {\r\n  imports: {\r\n    _Z12testFunctioni: function(arg) {\r\n      console.log(arg);\r\n    }\r\n  }\r\n};\r\n\r\nfetch('test.wasm').then(function(response) {\r\n  response.arrayBuffer().then(function(bytes) {\r\n    WebAssembly.instantiate(bytes, importObject).then(function(obj) {\r\n    \t obj.instance.exports._Z12testFunctioni(num)       \r\n    })\r\n  })\r\n});\r\n\r\nconsole.log( _Z12testFunctioni(10) )\r\n\r\n```\r\n"}}
{"actor":{"display_login":"Gurigraphics"}}