Mercurial > hg > orthanc-stone
comparison Deprecated/Samples/WebAssembly/app.js @ 1402:65e1e4b08302
moved deprecated samples into Deprecated
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Wed, 29 Apr 2020 20:50:53 +0200 |
parents | Samples/Deprecated/WebAssembly/app.js@eac254fb6791 |
children |
comparison
equal
deleted
inserted
replaced
1401:f6a2d46d2b76 | 1402:65e1e4b08302 |
---|---|
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 } |