Mercurial > hg > orthanc-stone
comparison Platforms/Wasm/stone-framework-loader.ts @ 238:126c9c0c9333 am
SimpleViewer demo running both with SDL and Wasm
author | am@osimis.io |
---|---|
date | Wed, 20 Jun 2018 09:25:39 +0200 |
parents | b4642964c355 |
children | 5055031f4a06 |
comparison
equal
deleted
inserted
replaced
237:b4642964c355 | 238:126c9c0c9333 |
---|---|
13 | 13 |
14 | 14 |
15 export class Framework | 15 export class Framework |
16 { | 16 { |
17 private static singleton_ : Framework = null; | 17 private static singleton_ : Framework = null; |
18 | 18 private static wasmModuleName_ : string = null; |
19 | |
20 public static Configure(wasmModuleName: string) { | |
21 this.wasmModuleName_ = wasmModuleName; | |
22 } | |
23 | |
19 private constructor(verbose : boolean) | 24 private constructor(verbose : boolean) |
20 { | 25 { |
21 //this.ccall('Initialize', null, [ 'number' ], [ verbose ]); | 26 //this.ccall('Initialize', null, [ 'number' ], [ verbose ]); |
22 } | 27 } |
23 | 28 |
50 | 55 |
51 | 56 |
52 public static Initialize(verbose: boolean, | 57 public static Initialize(verbose: boolean, |
53 callback: InitializationCallback) | 58 callback: InitializationCallback) |
54 { | 59 { |
55 console.log('Initializing WebAssembly'); | 60 console.log('Initializing WebAssembly Module'); |
56 | 61 |
57 (<any> window).StoneFrameworkModule = { | 62 (<any> window).StoneFrameworkModule = { |
58 preRun: [ | 63 preRun: [ |
59 function() { | 64 function() { |
60 console.log('Loading the Stone Framework using WebAssembly'); | 65 console.log('Loading the Stone Framework using WebAssembly'); |
81 | 86 |
82 // Dynamic loading of the JavaScript wrapper around WebAssembly | 87 // Dynamic loading of the JavaScript wrapper around WebAssembly |
83 var script = document.createElement('script'); | 88 var script = document.createElement('script'); |
84 script.type = 'application/javascript'; | 89 script.type = 'application/javascript'; |
85 //script.src = "orthanc-stone.js"; // ASSETS_FOLDER + '/' + WASM_FILENAME + '.js'; | 90 //script.src = "orthanc-stone.js"; // ASSETS_FOLDER + '/' + WASM_FILENAME + '.js'; |
86 script.src = "OrthancStoneSimpleViewer.js"; // ASSETS_FOLDER + '/' + WASM_FILENAME + '.js'; | 91 script.src = this.wasmModuleName_ + ".js";// "OrthancStoneSimpleViewer.js"; // ASSETS_FOLDER + '/' + WASM_FILENAME + '.js'; |
87 script.async = true; | 92 script.async = true; |
88 document.head.appendChild(script); | 93 document.head.appendChild(script); |
89 } | 94 } |
90 } | 95 } |
91 } | 96 } |