comparison src/app/services/feature-extraction/FeatureExtractionWorker.ts @ 320:a16d968d646e

Bodge in to load pyin and nnls-chroma from server on startup
author Lucas Thompson <dev@lucas.im>
date Mon, 15 May 2017 23:52:23 +0100
parents 75a234459d3b
children 89208e8af8cc
comparison
equal deleted inserted replaced
319:64dee0c156b1 320:a16d968d646e
109 private service: AggregateStreamingService; 109 private service: AggregateStreamingService;
110 110
111 constructor(workerScope: DedicatedWorkerGlobalScope, 111 constructor(workerScope: DedicatedWorkerGlobalScope,
112 private requireJs: RequireJs) { 112 private requireJs: RequireJs) {
113 this.workerScope = workerScope; 113 this.workerScope = workerScope;
114 this.remoteLibraries = new Map<LibraryKey, LibraryUri>(); 114 this.remoteLibraries = new Map<LibraryKey, LibraryUri>([
115 ['nnls-chroma', 'assets/extractors/NNLSChroma.js'],
116 ['pyin', 'assets/extractors/PYin.umd.js'],
117 ]);
115 this.service = new ThrottledReducingAggregateService(); 118 this.service = new ThrottledReducingAggregateService();
116 this.setupImportLibraryListener(); 119 this.setupImportLibraryListener();
117 this.server = new WebWorkerStreamingServer( 120 this.server = new WebWorkerStreamingServer(
118 this.workerScope, 121 this.workerScope,
119 this.service 122 this.service
122 125
123 private setupImportLibraryListener(): void { 126 private setupImportLibraryListener(): void {
124 127
125 this.workerScope.onmessage = (ev: MessageEvent) => { 128 this.workerScope.onmessage = (ev: MessageEvent) => {
126 const sendResponse = (result) => { 129 const sendResponse = (result) => {
130 console.warn(ev.data.method);
127 this.workerScope.postMessage({ 131 this.workerScope.postMessage({
128 method: ev.data.method, 132 method: ev.data.method,
129 result: result 133 result: result
130 }); 134 });
131 }; 135 };