comparison Resources/Graveyard/Deprecated/Samples/WebAssembly/app.js @ 1503:553084468225

moving /Deprecated/ to /Resources/Graveyard/Deprecated/
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Jun 2020 11:38:13 +0200
parents Deprecated/Samples/WebAssembly/app.js@65e1e4b08302
children
comparison
equal deleted inserted replaced
1502:e5729dab3f67 1503:553084468225
1 /**
2 * This is a generic bootstrap code that is shared by all the Stone
3 * sample applications.
4 **/
5
6 // Check support for WebAssembly
7 if (!('WebAssembly' in window)) {
8 alert('Sorry, your browser does not support WebAssembly :(');
9 } else {
10
11 // Wait for the module to be loaded (the event "WebAssemblyLoaded"
12 // must be emitted by the "main" function)
13 window.addEventListener('WebAssemblyLoaded', function() {
14
15 // Loop over the GET arguments
16 var parameters = window.location.search.substr(1);
17 if (parameters != null && parameters != '') {
18 var tokens = parameters.split('&');
19 for (var i = 0; i < tokens.length; i++) {
20 var arg = tokens[i].split('=');
21 if (arg.length == 2) {
22
23 // Send each GET argument to WebAssembly
24 Module.ccall('SetArgument', null, [ 'string', 'string' ],
25 [ arg[0], decodeURIComponent(arg[1]) ]);
26 }
27 }
28 }
29
30 // Inform the WebAssembly module that it can start
31 Module.ccall('Initialize', null, null, null);
32 });
33 }