Mercurial > hg > ugly-duckling
view 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 source
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); }; } }