diff Platforms/Wasm/wasm-application.ts @ 255:65562a28fe05 am-2

fixes for WASM
author am@osimis.io
date Tue, 03 Jul 2018 13:19:56 +0200
parents 8ff70c04c6df
children
line wrap: on
line diff
--- a/Platforms/Wasm/wasm-application.ts	Tue Jul 03 11:49:02 2018 +0200
+++ b/Platforms/Wasm/wasm-application.ts	Tue Jul 03 13:19:56 2018 +0200
@@ -10,6 +10,7 @@
 // global functions
 var WasmWebService_NotifyError: Function = null;
 var WasmWebService_NotifySuccess: Function = null;
+var WasmWebService_SetBaseUri: Function = null;
 var NotifyUpdateContent: Function = null;
 var SetStartupParameter: Function = null;
 var CreateWasmApplication: Function = null;
@@ -66,10 +67,12 @@
 }
 
 
-function _InitializeWasmApplication(canvasId: string): void {
+function _InitializeWasmApplication(canvasId: string, orthancBaseUrl: string): void {
 
   /************************************** */
   CreateWasmApplication();
+  WasmWebService_SetBaseUri(orthancBaseUrl);
+
 
   // parse uri and transmit the parameters to the app before initializing it
   var parameters = GetUriParameters();
@@ -104,15 +107,16 @@
 
     WasmWebService_NotifySuccess = StoneFrameworkModule.cwrap('WasmWebService_NotifySuccess', null, ['number', 'string', 'array', 'number', 'number']);
     WasmWebService_NotifyError = StoneFrameworkModule.cwrap('WasmWebService_NotifyError', null, ['number', 'string', 'number']);
+    WasmWebService_SetBaseUri = StoneFrameworkModule.cwrap('WasmWebService_SetBaseUri', null, ['string']);
     NotifyUpdateContent = StoneFrameworkModule.cwrap('NotifyUpdateContent', null, []);
 
-    StoneFrameworkModule.ccall('WasmWebService_SetBaseUri', null, ['string'], [orthancBaseUrl]);
+    console.log("Connecting C++ methods to JS methods - done - 2");
 
     // Prevent scrolling
     document.body.addEventListener('touchmove', function (event) {
       event.preventDefault();
     }, false);
 
-    _InitializeWasmApplication("canvas");
+    _InitializeWasmApplication("canvas", orthancBaseUrl);
   });
 }
\ No newline at end of file