# HG changeset patch # User am@osimis.io # Date 1529480616 -7200 # Node ID ddbb339ed4cf6fd7451266ed1ba803f211694e27 # Parent 72b711f22a2b125234f3b1892ed6235656f322ca orthancBaseUrl is now configurable diff -r 72b711f22a2b -r ddbb339ed4cf Applications/Samples/Web/simple-viewer.ts --- a/Applications/Samples/Web/simple-viewer.ts Wed Jun 20 09:26:15 2018 +0200 +++ b/Applications/Samples/Web/simple-viewer.ts Wed Jun 20 09:43:36 2018 +0200 @@ -1,3 +1,3 @@ /// -InitializeWasmApplication("OrthancStoneSimpleViewer"); +InitializeWasmApplication("OrthancStoneSimpleViewer", "../../../stone-orthanc"); diff -r 72b711f22a2b -r ddbb339ed4cf Platforms/Wasm/WasmWebService.cpp --- a/Platforms/Wasm/WasmWebService.cpp Wed Jun 20 09:26:15 2018 +0200 +++ b/Platforms/Wasm/WasmWebService.cpp Wed Jun 20 09:43:36 2018 +0200 @@ -48,6 +48,11 @@ } } + void EMSCRIPTEN_KEEPALIVE WasmWebService_SetBaseUrl(const char* baseUrl) + { + OrthancStone::WasmWebService::GetInstance().SetBaseUrl(baseUrl); + } + #ifdef __cplusplus } #endif diff -r 72b711f22a2b -r ddbb339ed4cf Platforms/Wasm/WasmWebService.h --- a/Platforms/Wasm/WasmWebService.h Wed Jun 20 09:26:15 2018 +0200 +++ b/Platforms/Wasm/WasmWebService.h Wed Jun 20 09:43:36 2018 +0200 @@ -11,7 +11,7 @@ // Private constructor => Singleton design pattern WasmWebService() : - base_("../../") // TODO: this should be configurable from the JS code ! + base_("../../") // note: this is configurable from the JS code by calling WasmWebService_SetBaseUrl { } diff -r 72b711f22a2b -r ddbb339ed4cf Platforms/Wasm/wasm-application.ts --- a/Platforms/Wasm/wasm-application.ts Wed Jun 20 09:26:15 2018 +0200 +++ b/Platforms/Wasm/wasm-application.ts Wed Jun 20 09:43:36 2018 +0200 @@ -86,7 +86,7 @@ UpdateContentThread(); } -function InitializeWasmApplication(wasmModuleName: string) { +function InitializeWasmApplication(wasmModuleName: string, orthancBaseUrl: string) { Stone.Framework.Configure(wasmModuleName); @@ -106,6 +106,8 @@ WasmWebService_NotifyError = StoneFrameworkModule.cwrap('WasmWebService_NotifyError', null, ['number', 'string', 'number']); NotifyUpdateContent = StoneFrameworkModule.cwrap('NotifyUpdateContent', null, []); + StoneFrameworkModule.ccall('WasmWebService_SetBaseUrl', null, ['string'], [orthancBaseUrl]); + // Prevent scrolling document.body.addEventListener('touchmove', function (event) { event.preventDefault();