comparison src/app/services/feature-extraction/FeatureExtractionWorker.ts @ 47:933c64ebcd13

Some extraction logic in place.
author Lucas Thompson <dev@lucas.im>
date Mon, 05 Dec 2016 16:57:34 +0000
parents 13f5f228ed98
children 2171dd56756c
comparison
equal deleted inserted replaced
46:88052122ec01 47:933c64ebcd13
21 private workerScope: WorkerGlobalScope; 21 private workerScope: WorkerGlobalScope;
22 private piperClient: PiperSimpleClient; 22 private piperClient: PiperSimpleClient;
23 23
24 constructor(workerScope: WorkerGlobalScope) { 24 constructor(workerScope: WorkerGlobalScope) {
25 this.workerScope = workerScope; 25 this.workerScope = workerScope;
26 let counter = 0;
27 setInterval(() => this.workerScope.postMessage(counter++), 1000);
28 this.piperClient = new PiperSimpleClient(new EmscriptenProxy(VampExamplePlugins())); 26 this.piperClient = new PiperSimpleClient(new EmscriptenProxy(VampExamplePlugins()));
29 this.workerScope.onmessage = (ev: MessageEvent) => { 27 this.workerScope.onmessage = (ev: MessageEvent) => {
28 const sendResponse = (result) => this.workerScope.postMessage({
29 method: ev.data.method,
30 result: result
31 });
30 switch (ev.data.method) { 32 switch (ev.data.method) {
31 case 'list': 33 case 'list':
32 this.piperClient.list({}).then(this.workerScope.postMessage); 34 this.piperClient.list({}).then(sendResponse);
35 break;
36 case 'process':
37 this.piperClient.process(ev.data.params).then(sendResponse);
33 } 38 }
34 }; 39 };
35 } 40 }
36 41
37
38 } 42 }