Skip to content

AudioWorkletNodeOptions.processorOptions should not default to null. #2011

Closed

Description

@hoch

Describe the issue
Because it is defaulting to null, the processor always get null for the field even the main scope option object is undefined. We should make it a plain object.

object processorOptions;

Where Is It
https://webaudio.github.io/web-audio-api/#dictdef-audioworkletnodeoptions

Activity

  1. self-assigned this
    on Jul 25, 2019
  2. guest271314 commented on Jul 25, 2019

    @guest271314
  3. hoch commented on Jul 25, 2019

    @hoch
    MemberAuthor

    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'}}
  4. hoch commented on Jul 25, 2019

    @hoch
    MemberAuthor

    From WG Telecon:
    Remove the nullable type and the default value from processorOptions.

  5. karlt commented on Jul 25, 2019

    @karlt
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions