Skip to content

Commit 0f54f32

Browse files
committed
sytle: add error throw
1 parent 266f43d commit 0f54f32

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/modules/WebAudio/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export default class WebAudio {
2222
}
2323

2424
get _audioDuration(): number {
25+
if (!this.audioBuffer)
26+
throw new Error('can not get duration before audio inited')
2527
return this.audioBuffer.duration
2628
}
2729

@@ -36,7 +38,7 @@ export default class WebAudio {
3638
}
3739

3840
private createFilterData(): Promise<number[][]> {
39-
const samplingRate: number | undefined = this.props.samplingRate
41+
const samplingRate: number = this.props.samplingRate as number
4042
const channels: number = this.audioBuffer.numberOfChannels
4143
const rawDataList: Float32Array[] = []
4244
const filteredData: number[][] = []

0 commit comments

Comments
 (0)