Mercurial > hg > orthanc-stone
view Samples/WebAssembly/RtViewer/RtViewerWasmApp.js @ 1392:ffdb82850e98
Sdl run loop in /Common (might revert if need to customize)
Segregation ongoing between sdl wasm
Both samples ok SDL msvc v141 x64
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 28 Apr 2020 13:52:21 +0200 |
parents | 24bcff8ea58f |
children | 27e0a00bd3e8 |
line wrap: on
line source
// Check support for WebAssembly if (!('WebAssembly' in window)) { alert('Sorry, your browser does not support WebAssembly :('); } else { // Wait for the module to be loaded (the event "WebAssemblyLoaded" // must be emitted by the "main" function) window.addEventListener('WebAssemblyLoaded', function() { // Loop over the GET arguments var parameters = window.location.search.substr(1); if (parameters != null && parameters != '') { var tokens = parameters.split('&'); for (var i = 0; i < tokens.length; i++) { var arg = tokens[i].split('='); if (arg.length == 2) { // Send each GET argument to WebAssembly Module.ccall('SetArgument', null, [ 'string', 'string' ], [ arg[0], decodeURIComponent(arg[1]) ]); } } } // Inform the WebAssembly module that it can start Module.ccall('Initialize', null, null, null); }); }