Closed hoch closed 5 years ago
Not gathering what the expected result is. Can you include short snippets of code detailing what the expected output is for each input where options are passed or not passed?
The setup code:
const node = new AudioWorkletNode(context, 'processor', nodeOptions);
class extends AudioWorkletProcessor {
constructor(options){
console.log(options);
}
}
When nodeOptions = {}
:
{numberOfInputs: 1, numberOfOutputs:1}
When nodeOptions = {foo: 'bar'}
:
{numberOfInputs: 1, numberOfOutputs:1}
When nodeOptions = {foo:bar, processorOptions: {foo:'bar'}}
:
{numberOfInputs: 1, numberOfOutputs:1, processorOptions: {foo:'bar'}}
From WG Telecon:
Remove the nullable
type and the default value from processorOptions
.
I'm not aware of any benefit in processorOptions
being nullable.
If the value could default to the empty object, then that would permit clients to test for members without throwing a TypeError when processorOptions
is not specified, but I don't think it is possible to specify an empty object default in WebIDL.
So, yes, the proposed change seems the best option available.
Describe the issue Because it is defaulting to
null
, the processor always getnull
for the field even the main scope option object is undefined. We should make it a plain object.Where Is It https://webaudio.github.io/web-audio-api/#dictdef-audioworkletnodeoptions