@@ -762,8 +762,9 @@ class Howl {
762
762
/**
763
763
* Pause playback and save current position.
764
764
* @param id The sound ID (empty to pause all in group).
765
+ * @param skipEmit If true, the `pause` event won't be emitted.
765
766
*/
766
- pause ( id : number ) {
767
+ pause ( id : number , skipEmit ?: boolean ) {
767
768
// If the sound hasn't loaded or a play() promise is pending, add it to the load queue to pause when capable.
768
769
if ( this . _state !== 'loaded' || this . _playLock ) {
769
770
this . _queue . push ( {
@@ -832,8 +833,8 @@ class Howl {
832
833
}
833
834
}
834
835
835
- // Fire the pause event, unless `true` is passed as the 2nd argument.
836
- if ( ! arguments [ 1 ] ) {
836
+ // Fire the pause event, unless skipEmit is `true`
837
+ if ( ! skipEmit ) {
837
838
this . _emit ( 'pause' , sound ? sound . _id : null ) ;
838
839
}
839
840
}
@@ -1298,11 +1299,10 @@ class Howl {
1298
1299
* rate(id) -> Returns the sound id's current playback rate.
1299
1300
* rate(rate) -> Sets the playback rate of all sounds in this Howl group.
1300
1301
* rate(rate, id) -> Sets the playback rate of passed sound id.
1301
- * @return { Howl/Number } Returns this or the current playback rate.
1302
+ * @return Returns this or the current playback rate.
1302
1303
*/
1303
- rate ( ) {
1304
- var args = arguments ;
1305
- var rate , id ;
1304
+ rate ( ...args ) {
1305
+ let rate , id ;
1306
1306
1307
1307
// Determine the values based on arguments.
1308
1308
if ( args . length === 0 ) {
@@ -1323,7 +1323,7 @@ class Howl {
1323
1323
}
1324
1324
1325
1325
// Update the playback rate or return the current value.
1326
- var sound ;
1326
+ let sound ;
1327
1327
if ( typeof rate === 'number' ) {
1328
1328
// If the sound hasn't loaded, add it to the load queue to change playback rate when capable.
1329
1329
if ( this . _state !== 'loaded' || this . _playLock ) {
@@ -1370,12 +1370,12 @@ class Howl {
1370
1370
}
1371
1371
1372
1372
// Reset the timers.
1373
- var seek = this . seek ( id [ i ] ) ;
1374
- var duration =
1373
+ const seek = this . seek ( id [ i ] ) as number ;
1374
+ const duration =
1375
1375
( this . _sprite [ sound . _sprite ] [ 0 ] + this . _sprite [ sound . _sprite ] [ 1 ] ) /
1376
1376
1000 -
1377
1377
seek ;
1378
- var timeout = ( duration * 1000 ) / Math . abs ( sound . _rate ) ;
1378
+ const timeout = ( duration * 1000 ) / Math . abs ( sound . _rate ) ;
1379
1379
1380
1380
// Start a new end timer if sound is already playing.
1381
1381
if ( this . _endTimers [ id [ i ] ] || ! sound . _paused ) {
@@ -1406,8 +1406,7 @@ class Howl {
1406
1406
* @return Returns this or the current seek position.
1407
1407
*/
1408
1408
seek ( ...args ) {
1409
- let seek : number | undefined = undefined ,
1410
- id : number | undefined = undefined ;
1409
+ let seek , id ;
1411
1410
1412
1411
// Determine the values based on arguments.
1413
1412
if ( args . length === 0 ) {
0 commit comments