Skip to content

Commit 2e3e97d

Browse files
committed
improvements
1 parent 7feaaa9 commit 2e3e97d

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/howler.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ class Howler {
6161

6262
/**
6363
* Get/set the global volume for all sounds.
64-
* @param {Float} vol Volume from 0.0 to 1.0.
65-
* @return {Howler/Float} Returns self or current volume.
64+
* @param vol Volume from 0.0 to 1.0.
65+
* @return Returns self or current volume.
6666
*/
67-
volume(vol?: string) {
68-
const volume = typeof vol === 'string' ? parseFloat(vol) : undefined;
67+
volume(vol?: number | string) {
68+
const volume = parseFloat(vol as string);
6969

7070
// If we don't have an AudioContext created yet, run the setup.
7171
if (!this.ctx) {
@@ -164,7 +164,6 @@ class Howler {
164164

165165
/**
166166
* Unload and destroy all currently loaded Howl objects.
167-
* @return {Howler}
168167
*/
169168
unload() {
170169
for (var i = this._howls.length - 1; i >= 0; i--) {
@@ -187,15 +186,14 @@ class Howler {
187186

188187
/**
189188
* Check for codec support of specific extension.
190-
* @param {String} ext Audio file extention.
189+
* @param ext Audio file extention.
191190
*/
192191
codecs(ext: string) {
193192
return this._codecs[ext.replace(/^x-/, '')];
194193
}
195194

196195
/**
197196
* Setup various state values for global tracking.
198-
* @return {Howler}
199197
*/
200198
_setup() {
201199
// Keeps track of the suspend/resume state of the AudioContext.
@@ -306,7 +304,6 @@ class Howler {
306304

307305
/**
308306
* Check for browser support for various codecs and cache the results.
309-
* @return {Howler}
310307
*/
311308
_setupCodecs() {
312309
let audioTest: HTMLAudioElement | null = null;
@@ -517,7 +514,7 @@ class Howler {
517514
/**
518515
* Get an unlocked HTML5 Audio object from the pool. If none are left,
519516
* return a new Audio object and throw a warning.
520-
* @return {Audio} HTML5 Audio object.
517+
* @return HTML5 Audio object.
521518
*/
522519
_obtainHtml5Audio() {
523520
// Return the next object from the pool if one exists.
@@ -545,7 +542,6 @@ class Howler {
545542

546543
/**
547544
* Return an activated HTML5 Audio object to the pool.
548-
* @return {Howler}
549545
*/
550546
_releaseHtml5Audio(audio: HowlerAudioElement) {
551547
// Don't add audio to the pool if we don't know if it has been unlocked.
@@ -559,7 +555,6 @@ class Howler {
559555
/**
560556
* Automatically suspend the Web Audio AudioContext after no sound has played for 30 seconds.
561557
* This saves processing/energy and fixes various browser-specific bugs with audio getting stuck.
562-
* @return {Howler}
563558
*/
564559
_autoSuspend() {
565560
if (
@@ -617,7 +612,6 @@ class Howler {
617612

618613
/**
619614
* Automatically resume the Web Audio AudioContext when a new sound is played.
620-
* @return {Howler}
621615
*/
622616
_autoResume() {
623617
if (

0 commit comments

Comments
 (0)