abstract classes must take the options object

no passing in individual parameters. This simplifies the code a little
This commit is contained in:
Yotam Mann 2019-07-24 23:33:31 -04:00
parent 2f7d4111ee
commit 923940576c
2 changed files with 5 additions and 13 deletions

View file

@ -69,12 +69,8 @@ extends ToneWithContext<Options> {
});
}
constructor(options: Partial<ToneAudioNodeOptions>);
constructor() {
super(optionsFromArguments(ToneAudioNode.getDefaults(), arguments, ["context"]));
const options = optionsFromArguments(ToneAudioNode.getDefaults(), arguments, ["context"]);
constructor(options: ToneAudioNodeOptions) {
super(options);
this.numberOfInputs = options.numberOfInputs;
this.numberOfOutputs = options.numberOfOutputs;
}

View file

@ -94,15 +94,11 @@ export abstract class Source<Options extends SourceOptions> extends ToneAudioNod
private _syncedStart: (time: Seconds, offset: Seconds) => void = noOp;
private _syncedStop: (time: Seconds) => void = noOp;
constructor(options: Partial<SourceOptions>);
constructor() {
super(optionsFromArguments(Volume.getDefaults(), arguments, ["volume"]));
const options = optionsFromArguments(Volume.getDefaults(), arguments, ["volume"]);
constructor(options: SourceOptions) {
super(options);
readOnly(this, "volume");
this._state.memory = 100;
this.volume.value = options.volume;
this.volume.setValueAtTime(options.volume, 0);
// set mute initially
this.mute = options.mute;