comparison 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
comparison
equal deleted inserted replaced
254:abc1c6231947 255:65562a28fe05
8 declare var StoneFrameworkModule : Stone.Framework; 8 declare var StoneFrameworkModule : Stone.Framework;
9 9
10 // global functions 10 // global functions
11 var WasmWebService_NotifyError: Function = null; 11 var WasmWebService_NotifyError: Function = null;
12 var WasmWebService_NotifySuccess: Function = null; 12 var WasmWebService_NotifySuccess: Function = null;
13 var WasmWebService_SetBaseUri: Function = null;
13 var NotifyUpdateContent: Function = null; 14 var NotifyUpdateContent: Function = null;
14 var SetStartupParameter: Function = null; 15 var SetStartupParameter: Function = null;
15 var CreateWasmApplication: Function = null; 16 var CreateWasmApplication: Function = null;
16 var CreateCppViewport: Function = null; 17 var CreateCppViewport: Function = null;
17 var ReleaseCppViewport: Function = null; 18 var ReleaseCppViewport: Function = null;
64 } 65 }
65 } 66 }
66 } 67 }
67 68
68 69
69 function _InitializeWasmApplication(canvasId: string): void { 70 function _InitializeWasmApplication(canvasId: string, orthancBaseUrl: string): void {
70 71
71 /************************************** */ 72 /************************************** */
72 CreateWasmApplication(); 73 CreateWasmApplication();
74 WasmWebService_SetBaseUri(orthancBaseUrl);
75
73 76
74 // parse uri and transmit the parameters to the app before initializing it 77 // parse uri and transmit the parameters to the app before initializing it
75 var parameters = GetUriParameters(); 78 var parameters = GetUriParameters();
76 79
77 for (var key in parameters) { 80 for (var key in parameters) {
102 ReleaseCppViewport = StoneFrameworkModule.cwrap('ReleaseCppViewport', null, ['number']); 105 ReleaseCppViewport = StoneFrameworkModule.cwrap('ReleaseCppViewport', null, ['number']);
103 StartWasmApplication = StoneFrameworkModule.cwrap('StartWasmApplication', null, ['number']); 106 StartWasmApplication = StoneFrameworkModule.cwrap('StartWasmApplication', null, ['number']);
104 107
105 WasmWebService_NotifySuccess = StoneFrameworkModule.cwrap('WasmWebService_NotifySuccess', null, ['number', 'string', 'array', 'number', 'number']); 108 WasmWebService_NotifySuccess = StoneFrameworkModule.cwrap('WasmWebService_NotifySuccess', null, ['number', 'string', 'array', 'number', 'number']);
106 WasmWebService_NotifyError = StoneFrameworkModule.cwrap('WasmWebService_NotifyError', null, ['number', 'string', 'number']); 109 WasmWebService_NotifyError = StoneFrameworkModule.cwrap('WasmWebService_NotifyError', null, ['number', 'string', 'number']);
110 WasmWebService_SetBaseUri = StoneFrameworkModule.cwrap('WasmWebService_SetBaseUri', null, ['string']);
107 NotifyUpdateContent = StoneFrameworkModule.cwrap('NotifyUpdateContent', null, []); 111 NotifyUpdateContent = StoneFrameworkModule.cwrap('NotifyUpdateContent', null, []);
108 112
109 StoneFrameworkModule.ccall('WasmWebService_SetBaseUri', null, ['string'], [orthancBaseUrl]); 113 console.log("Connecting C++ methods to JS methods - done - 2");
110 114
111 // Prevent scrolling 115 // Prevent scrolling
112 document.body.addEventListener('touchmove', function (event) { 116 document.body.addEventListener('touchmove', function (event) {
113 event.preventDefault(); 117 event.preventDefault();
114 }, false); 118 }, false);
115 119
116 _InitializeWasmApplication("canvas"); 120 _InitializeWasmApplication("canvas", orthancBaseUrl);
117 }); 121 });
118 } 122 }