From 4e9c4b161be60c51af0edf9e1f99c7365936f0dc Mon Sep 17 00:00:00 2001 From: chrisguttandin Date: Thu, 29 Mar 2018 01:00:58 +0200 Subject: [PATCH] fix: blur EventTarget definition to support TypeScript v2.6 --- src/audio-nodes/audio-destination-node.ts | 4 ++-- src/audio-nodes/audio-node.ts | 4 ++-- src/event-target.ts | 4 ++-- src/interfaces/native-constant-source-node.ts | 12 ++++++++++-- ...uled-source-node-stop-method-consecutive-calls.ts | 4 ++-- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/audio-nodes/audio-destination-node.ts b/src/audio-nodes/audio-destination-node.ts index be7a657a9..072075247 100644 --- a/src/audio-nodes/audio-destination-node.ts +++ b/src/audio-nodes/audio-destination-node.ts @@ -117,7 +117,7 @@ export class AudioDestinationNode implements IAudioDestinationNode { public addEventListener ( type: string, - listener: EventListenerOrEventListenerObject | null = null, + listener: any, // @todo EventListenerOrEventListenerObject | null = null, options?: boolean | AddEventListenerOptions ): void { return this._audioNode.addEventListener(type, listener, options); @@ -143,7 +143,7 @@ export class AudioDestinationNode implements IAudioDestinationNode { public removeEventListener ( type: string, - listener: EventListenerOrEventListenerObject | null = null, + listener: any, // @todo EventListenerOrEventListenerObject | null = null, options?: EventListenerOptions | boolean ): void { return this._audioNode.removeEventListener(type, listener, options); diff --git a/src/audio-nodes/audio-node.ts b/src/audio-nodes/audio-node.ts index ae92e42c6..f05bfdcf1 100644 --- a/src/audio-nodes/audio-node.ts +++ b/src/audio-nodes/audio-node.ts @@ -112,7 +112,7 @@ export class AudioNode exten public addEventListener ( type: string, - listener: EventListenerOrEventListenerObject | null = null, + listener: any, // @todo EventListenerOrEventListenerObject | null = null, options?: boolean | AddEventListenerOptions ): void { return this._nativeNode.addEventListener(type, listener, options); @@ -275,7 +275,7 @@ export class AudioNode exten public removeEventListener ( type: string, - listener: EventListenerOrEventListenerObject | null = null, + listener: any, // @todo EventListenerOrEventListenerObject | null = null, options?: EventListenerOptions | boolean ): void { return this._nativeNode.removeEventListener(type, listener, options); diff --git a/src/event-target.ts b/src/event-target.ts index 8defdbcf6..dbfadaa01 100644 --- a/src/event-target.ts +++ b/src/event-target.ts @@ -2,7 +2,7 @@ export class EventTarget { public addEventListener ( type: string, - listener: EventListenerOrEventListenerObject | null, + listener: any, // @todo EventListenerOrEventListenerObject | null = null, options?: boolean | AddEventListenerOptions ): void { // @todo Implement the addEventListener() method. @@ -20,7 +20,7 @@ export class EventTarget { public removeEventListener ( type: string, - listener?: EventListenerOrEventListenerObject | null, + listener: any, // @todo EventListenerOrEventListenerObject | null = null, options?: EventListenerOptions | boolean ): void { // @todo Implement the removeEventListener() method. diff --git a/src/interfaces/native-constant-source-node.ts b/src/interfaces/native-constant-source-node.ts index e28a76c24..08e35074c 100644 --- a/src/interfaces/native-constant-source-node.ts +++ b/src/interfaces/native-constant-source-node.ts @@ -12,14 +12,22 @@ export interface INativeConstantSourceNode extends AudioNode { listener: (this: OscillatorNode, ev: INativeConstantSourceNodeMap[K]) => any, options?: boolean | AddEventListenerOptions ): void; - addEventListener (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + addEventListener ( + type: string, + listener: any, // @todo EventListenerOrEventListenerObject, + options?: boolean | AddEventListenerOptions + ): void; removeEventListener ( type: K, listener: (this: OscillatorNode, ev: INativeConstantSourceNodeMap[K]) => any, options?: boolean | EventListenerOptions ): void; - removeEventListener (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; + removeEventListener ( + type: string, + listener: any, // @todo EventListenerOrEventListenerObject, + options?: boolean | EventListenerOptions + ): void; start (when?: number): void; diff --git a/src/wrappers/audio-scheduled-source-node-stop-method-consecutive-calls.ts b/src/wrappers/audio-scheduled-source-node-stop-method-consecutive-calls.ts index 8836cc489..357c6e4c5 100644 --- a/src/wrappers/audio-scheduled-source-node-stop-method-consecutive-calls.ts +++ b/src/wrappers/audio-scheduled-source-node-stop-method-consecutive-calls.ts @@ -22,11 +22,11 @@ export class AudioScheduledSourceNodeStopMethodConsecutiveCallsWrapper { const disconnectGainNode = ((disconnect) => { return () => { disconnect.call(audioScheduledSourceNode, gainNode); - audioScheduledSourceNode.removeEventListener('ended', disconnectGainNode); + ( audioScheduledSourceNode).removeEventListener('ended', disconnectGainNode); }; })(audioScheduledSourceNode.disconnect); - audioScheduledSourceNode.addEventListener('ended', disconnectGainNode); + ( audioScheduledSourceNode).addEventListener('ended', disconnectGainNode); audioScheduledSourceNode.connect = ((destination: TNativeAudioNode | TNativeAudioParam, output = 0, input = 0) => { if (destination instanceof AudioNode) {