Mercurial > hg > orthanc-stone
annotate Applications/Samples/Web/simple-viewer.ts @ 296:ac9fd144feae am-2
fix
author | am@osimis.io |
---|---|
date | Mon, 10 Sep 2018 12:20:14 +0200 |
parents | 2038d76bf13f |
children | be2660b6e40a |
rev | line source |
---|---|
287 | 1 ///<reference path='../../../Platforms/Wasm/wasm-application-runner.ts'/> |
238 | 2 |
264
6b98ac45aaee
documented how to compile and execute WASM samples
am@osimis.io
parents:
240
diff
changeset
|
3 InitializeWasmApplication("OrthancStoneSimpleViewer", "/orthanc"); |
287 | 4 |
5 function SelectTool(toolName: string) { | |
6 SendMessageToStoneApplication("select-tool:" + toolName); | |
7 } | |
8 | |
9 function PerformAction(actionName: string) { | |
10 SendMessageToStoneApplication("perform-action:" + actionName); | |
11 } | |
12 | |
13 //initializes the buttons | |
14 //----------------------- | |
15 // install "SelectTool" handlers | |
16 document.querySelectorAll("[tool-selector]").forEach((e) => { | |
17 console.log(e); | |
18 (e as HTMLInputElement).addEventListener("click", () => { | |
19 console.log(e); | |
20 SelectTool(e.attributes["tool-selector"].value); | |
21 }); | |
22 }); | |
23 | |
24 // install "PerformAction" handlers | |
25 document.querySelectorAll("[action-trigger]").forEach((e) => { | |
26 (e as HTMLInputElement).addEventListener("click", () => { | |
27 PerformAction(e.attributes["action-trigger"].value); | |
28 }); | |
29 }); | |
30 | |
31 // this method is called "from the C++ code" when the StoneApplication is updated. | |
32 // it can be used to update the UI of the application | |
33 function UpdateWebApplication(statusUpdateMessage: string) { | |
34 console.log(statusUpdateMessage); | |
35 | |
36 if (statusUpdateMessage.startsWith("series-description=")) { | |
37 document.getElementById("series-description").innerText = statusUpdateMessage.split("=")[1]; | |
38 } | |
39 } |