Mercurial > hg > orthanc
annotate Resources/WebAssembly/ArithmeticTests/app.js @ 3937:41eec97c23ef transcoding
documented new primitives in plugin SDK
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 18 May 2020 11:16:18 +0200 |
parents | 04873915beaf |
children |
rev | line source |
---|---|
2510
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 function Initialize() |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 { |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 Module.ccall('Run2', // name of C function |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 null, // return type |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 [], // argument types |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 []); |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 Module.ccall('Run', // name of C function |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 'number', // return type |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 [], // argument types |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 []); |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 } |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 var Module = { |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 preRun: [], |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 postRun: [ Initialize ], |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 print: function(text) { |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 console.log(text); |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 }, |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 printErr: function(text) { |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 if (text != 'Calling stub instead of signal()') |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 { |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 document.getElementById("stderr").textContent += text + '\n'; |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 } |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 }, |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 totalDependencies: 0 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 }; |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 if (!('WebAssembly' in window)) { |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 alert('Sorry, your browser does not support WebAssembly :('); |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 } else { |
04873915beaf
configuration of DCMTK for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 } |