Skip to content

Commit

Permalink
fix(types): align WebAudioContext.decodeAudioData signature with weap…
Browse files Browse the repository at this point in the history
…p docs

Updated the `decodeAudioData` method in `WebAudioContext` to match the official WeChat Mini Program documentation:
- Modified the return type to `Promise<AudioBuffer>` instead of `AudioBuffer`, because of this method' actual response.
- Adjusted method parameters to accept `audioData`, `successCallback`, and `errorCallback`.

This fixes the TypeScript error and aligns the implementation with the expected API behavior.
Closes NervJS#17080
  • Loading branch information
BH4HPA committed Dec 25, 2024
1 parent 7121844 commit 182420e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/taro/types/api/media/audio.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,11 @@ declare module '../../index' {
* ```
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.decodeAudioData.html
*/
decodeAudioData(): AudioBuffer
decodeAudioData(
audioData: ArrayBuffer,
successCallback: (buffer: AudioBuffer) => void,
errorCallback: (error: any) => void
): Promise<AudioBuffer>
}

namespace WebAudioContext {
Expand Down

0 comments on commit 182420e

Please sign in to comment.