diff src/app/services/feature-extraction/feature-extraction.service.ts @ 40:f7244f2155a3

Setup some scaffolding for bootstrapping a worker and loading into a service, providing a mechanism for implementing most of the logic which runs inside the worker in TypeScript.
author Lucas Thompson <dev@lucas.im>
date Thu, 01 Dec 2016 15:46:33 +0000
parents
children 13f5f228ed98
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/app/services/feature-extraction/feature-extraction.service.ts	Thu Dec 01 15:46:33 2016 +0000
@@ -0,0 +1,19 @@
+import { Injectable } from '@angular/core';
+
+@Injectable()
+export class FeatureExtractionService {
+
+  private worker: Worker;
+
+  constructor() {
+    this.worker = new Worker('bootstrap-feature-extraction-worker.js');
+  }
+
+  testMessageStream() {
+    this.worker.postMessage('anything');
+    this.worker.onmessage = (ev: MessageEvent) => {
+      console.log(ev.data);
+    };
+  }
+
+}