blob: c40b5a7179aefe43d30439a017625460ee03ccff [file] [log] [blame]
let singleton;
class Singleton extends AudioWorkletProcessor {
constructor() {
if (!singleton) {
singleton = new AudioWorkletProcessor();
singleton.process = function() {
this.port.postMessage({message: "process called"});
// This function will be called at most once for each AudioWorkletNode
// if the node has no input connections.
return false;
}
}
return singleton;
}
}
registerProcessor("singleton", Singleton);