Merge pull request #3657 from hraban/webaudioapi

[webaudioapi] Specialize event handler type
This commit is contained in:
Masahiro Wakame
2015-02-17 00:43:57 +09:00
2 changed files with 13 additions and 1 deletions
+8
View File
@@ -323,3 +323,11 @@ declare var footstepsBuffer: any;
context.startRendering();
}
// Test automatic type inference of the audio processing event handler
() => {
var context = new AudioContext();
var recorder = context.createScriptProcessor(2048, 1, 1);
recorder.onaudioprocess = function (e) {
e.inputBuffer;
};
}
+5 -1
View File
@@ -601,6 +601,10 @@ interface AudioBufferSourceNode extends AudioNode {
interface MediaElementAudioSourceNode extends AudioNode {
}
interface AudioProcessingEventHandler {
(e: AudioProcessingEvent): void;
}
/**
* This interface is an AudioNode which can generate, process, or analyse audio directly using JavaScript.
*
@@ -617,7 +621,7 @@ interface ScriptProcessorNode extends AudioNode {
/**
* An event listener which is called periodically for audio processing. An event of type AudioProcessingEvent will be passed to the event handler.
*/
onaudioprocess: EventHandler;
onaudioprocess: AudioProcessingEventHandler;
/**
* The size of the buffer (in sample-frames) which needs to be processed each time onprocessaudio is called. Legal values are (256, 512, 1024, 2048, 4096, 8192, 16384).