зеркало из https://github.com/mozilla/gecko-dev.git
23 строки
493 B
JavaScript
23 строки
493 B
JavaScript
class WasmProcessWorkletProcessor extends AudioWorkletProcessor {
|
|
constructor(...args) {
|
|
super(...args);
|
|
this.port.onmessage = e => {
|
|
WebAssembly.compile(e.data).then(
|
|
m => {
|
|
this.port.postMessage(m);
|
|
},
|
|
() => {
|
|
this.port.postMessage("error");
|
|
}
|
|
);
|
|
};
|
|
}
|
|
|
|
process(inputs, outputs, parameters) {
|
|
// Do nothing, output silence
|
|
return true;
|
|
}
|
|
}
|
|
|
|
registerProcessor("promise", WasmProcessWorkletProcessor);
|