Mercurial > hg > orthanc-stone
comparison Samples/Deprecated/WebAssembly/app.js @ 1348:eac254fb6791 broker
Moved Application/Samples/* to Application/Samples/Deprecated/* (remaining) + moved Samples/* to Samples/Deprecated/*
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 07 Apr 2020 14:31:28 +0200 |
parents | Samples/WebAssembly/app.js@d71cf8504159 |
children |
comparison
equal
deleted
inserted
replaced
1347:bfd77672d825 | 1348:eac254fb6791 |
---|---|
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 } |