Mercurial > hg > orthanc-stone
comparison Platforms/Wasm/wasm-application-runner.ts @ 526:548eed46f535 dev
introduced a Logger class that displays timing and source (C++/JS)
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Thu, 14 Mar 2019 19:04:35 +0100 |
parents | 7105a0bad250 |
children | 1c5104a6f7e4 79bb0a02d1cc |
comparison
equal
deleted
inserted
replaced
524:9e241cef32a4 | 526:548eed46f535 |
---|---|
1 import Stone = require('./stone-framework-loader'); | 1 import Stone = require('./stone-framework-loader'); |
2 import StoneViewport = require('./wasm-viewport'); | 2 import StoneViewport = require('./wasm-viewport'); |
3 import * as Logger from './logger' | |
3 | 4 |
4 if (!('WebAssembly' in window)) { | 5 if (!('WebAssembly' in window)) { |
5 alert('Sorry, your browser does not support WebAssembly :('); | 6 alert('Sorry, your browser does not support WebAssembly :('); |
6 } | 7 } |
7 | 8 |
83 | 84 |
84 // Wait for the Orthanc Framework to be initialized (this initializes | 85 // Wait for the Orthanc Framework to be initialized (this initializes |
85 // the WebAssembly environment) and then, create and initialize the Wasm application | 86 // the WebAssembly environment) and then, create and initialize the Wasm application |
86 Stone.Framework.Initialize(true, function () { | 87 Stone.Framework.Initialize(true, function () { |
87 | 88 |
88 console.log("Connecting C++ methods to JS methods"); | 89 Logger.defaultLogger.debug("Connecting C++ methods to JS methods"); |
89 | 90 |
90 SetStartupParameter = (<any> window).StoneFrameworkModule.cwrap('SetStartupParameter', null, ['string', 'string']); | 91 SetStartupParameter = (<any> window).StoneFrameworkModule.cwrap('SetStartupParameter', null, ['string', 'string']); |
91 CreateWasmApplication = (<any> window).StoneFrameworkModule.cwrap('CreateWasmApplication', null, ['number']); | 92 CreateWasmApplication = (<any> window).StoneFrameworkModule.cwrap('CreateWasmApplication', null, ['number']); |
92 CreateCppViewport = (<any> window).StoneFrameworkModule.cwrap('CreateCppViewport', 'number', []); | 93 CreateCppViewport = (<any> window).StoneFrameworkModule.cwrap('CreateCppViewport', 'number', []); |
93 ReleaseCppViewport = (<any> window).StoneFrameworkModule.cwrap('ReleaseCppViewport', null, ['number']); | 94 ReleaseCppViewport = (<any> window).StoneFrameworkModule.cwrap('ReleaseCppViewport', null, ['number']); |
101 WasmDoAnimation = (<any> window).StoneFrameworkModule.cwrap('WasmDoAnimation', null, []); | 102 WasmDoAnimation = (<any> window).StoneFrameworkModule.cwrap('WasmDoAnimation', null, []); |
102 | 103 |
103 SendSerializedMessageToStoneApplication = (<any> window).StoneFrameworkModule.cwrap('SendSerializedMessageToStoneApplication', 'string', ['string']); | 104 SendSerializedMessageToStoneApplication = (<any> window).StoneFrameworkModule.cwrap('SendSerializedMessageToStoneApplication', 'string', ['string']); |
104 SendCommandToStoneApplication = (<any> window).StoneFrameworkModule.cwrap('SendCommandToStoneApplication', 'string', ['string']); | 105 SendCommandToStoneApplication = (<any> window).StoneFrameworkModule.cwrap('SendCommandToStoneApplication', 'string', ['string']); |
105 | 106 |
106 console.log("Connecting C++ methods to JS methods - done"); | 107 Logger.defaultLogger.debug("Connecting C++ methods to JS methods - done"); |
107 | 108 |
108 // Prevent scrolling | 109 // Prevent scrolling |
109 document.body.addEventListener('touchmove', function (event) { | 110 document.body.addEventListener('touchmove', function (event) { |
110 event.preventDefault(); | 111 event.preventDefault(); |
111 }, false); | 112 }, false); |