Mercurial > hg > orthanc-stone
comparison Applications/Samples/SimpleViewer/Wasm/simple-viewer.ts @ 466:5055031f4a06 bgo-commands-codegen
- Added browserify to build. This allows using require calls for modules that
work with tsc compiler.
- removed older stuff related to Protocol Buffers and Flatbuffers
- changed triple-slash references to import statements
- module prefixes are now added at call sites
- added cmake module for filename handling
- switched to Ninja for sample build
- Added virtual dtor in ICommand
author | bgo-osimis |
---|---|
date | Mon, 11 Feb 2019 16:00:04 +0100 |
parents | daa04d15192c |
children | 7105a0bad250 |
comparison
equal
deleted
inserted
replaced
448:cc47e6eaefb0 | 466:5055031f4a06 |
---|---|
1 ///<reference path='../../../../Platforms/Wasm/wasm-application-runner.ts'/> | 1 import wasmApplicationRunner = require('../../../../Platforms/Wasm/wasm-application-runner'); |
2 | 2 |
3 InitializeWasmApplication("OrthancStoneSimpleViewer", "/orthanc"); | 3 wasmApplicationRunner.InitializeWasmApplication("OrthancStoneSimpleViewer", "/orthanc"); |
4 | 4 |
5 function SelectTool(toolName: string) { | 5 function SelectTool(toolName: string) { |
6 var command = { | 6 var command = { |
7 command: "selectTool:" + toolName, | 7 command: "selectTool:" + toolName, |
8 commandType: "generic-no-arg-command", | 8 commandType: "generic-no-arg-command", |
9 args: { | 9 args: { |
10 } | 10 } |
11 }; | 11 }; |
12 SendMessageToStoneApplication(JSON.stringify(command)); | 12 wasmApplicationRunner.SendMessageToStoneApplication(JSON.stringify(command)); |
13 | |
14 } | 13 } |
15 | 14 |
16 function PerformAction(actionName: string) { | 15 function PerformAction(actionName: string) { |
17 var command = { | 16 var command = { |
18 command: "action:" + actionName, | 17 command: "action:" + actionName, |
19 commandType: "generic-no-arg-command", | 18 commandType: "generic-no-arg-command", |
20 args: { | 19 args: { |
21 } | 20 } |
22 }; | 21 }; |
23 SendMessageToStoneApplication(JSON.stringify(command)); | 22 wasmApplicationRunner.SendMessageToStoneApplication(JSON.stringify(command)); |
24 } | 23 } |
25 | 24 |
26 class SimpleViewerUI { | 25 class SimpleViewerUI { |
27 | 26 |
28 private _labelPatientId: HTMLSpanElement; | 27 private _labelPatientId: HTMLSpanElement; |
29 private _labelStudyDescription: HTMLSpanElement; | 28 private _labelStudyDescription: HTMLSpanElement; |
30 | 29 |
31 public constructor() { | 30 public constructor() { |
32 // install "SelectTool" handlers | 31 // install "SelectTool" handlers |
33 document.querySelectorAll("[tool-selector]").forEach((e) => { | 32 document.querySelectorAll("[tool-selector]").forEach((e) => { |
34 console.log(e); | |
35 (e as HTMLButtonElement).addEventListener("click", () => { | 33 (e as HTMLButtonElement).addEventListener("click", () => { |
36 console.log(e); | |
37 SelectTool(e.attributes["tool-selector"].value); | 34 SelectTool(e.attributes["tool-selector"].value); |
38 }); | 35 }); |
39 }); | 36 }); |
40 | 37 |
41 // install "PerformAction" handlers | 38 // install "PerformAction" handlers |