@@ -1125,13 +1125,13 @@ var LibrarySDL = {
11251125 audio . paused = false ;
11261126 if ( ! webAudio . decodedBuffer ) {
11271127 if ( webAudio . onDecodeComplete === undefined ) abort ( "Cannot play back audio object that was not loaded" ) ;
1128- webAudio . onDecodeComplete . push ( function ( ) { if ( ! audio . paused ) SDL . playWebAudio ( audio ) ; } ) ;
1128+ webAudio . onDecodeComplete . push ( ( ) => { if ( ! audio . paused ) SDL . playWebAudio ( audio ) ; } ) ;
11291129 return ;
11301130 }
11311131 audio . webAudioNode = SDL . audioContext [ 'createBufferSource' ] ( ) ;
11321132 audio . webAudioNode [ 'buffer' ] = webAudio . decodedBuffer ;
11331133 audio . webAudioNode [ 'loop' ] = audio . loop ;
1134- audio . webAudioNode [ 'onended' ] = function ( ) { audio [ 'onended' ] ( ) ; } // For <media> element compatibility, route the onended signal to the instance.
1134+ audio . webAudioNode [ 'onended' ] = audio [ 'onended' ] ; // For <media> element compatibility, route the onended signal to the instance.
11351135
11361136 audio . webAudioPannerNode = SDL . audioContext [ 'createPanner' ] ( ) ;
11371137 // avoid Chrome bug
@@ -1457,9 +1457,11 @@ var LibrarySDL = {
14571457 SDL_SetVideoMode__deps : [ '$GL' ] ,
14581458 SDL_SetVideoMode__proxy : 'sync' ,
14591459 SDL_SetVideoMode : function ( width , height , depth , flags ) {
1460- [ 'touchstart' , 'touchend' , 'touchmove' , 'mousedown' , 'mouseup' , 'mousemove' , 'DOMMouseScroll' , 'mousewheel' , 'wheel' , 'mouseout' ] . forEach ( function ( event ) {
1461- Module [ 'canvas' ] . addEventListener ( event , SDL . receiveEvent , true ) ;
1462- } ) ;
1460+ [ 'touchstart' , 'touchend' , 'touchmove' ,
1461+ 'mousedown' , 'mouseup' , 'mousemove' ,
1462+ 'mousewheel' , 'wheel' , 'mouseout' ,
1463+ 'DOMMouseScroll' ,
1464+ ] . forEach ( ( e ) => Module [ 'canvas' ] . addEventListener ( e , SDL . receiveEvent , true ) ) ;
14631465
14641466 var canvas = Module [ 'canvas' ] ;
14651467
@@ -1471,7 +1473,7 @@ var LibrarySDL = {
14711473
14721474 if ( ! SDL . addedResizeListener ) {
14731475 SDL . addedResizeListener = true ;
1474- Browser . resizeListeners . push ( function ( w , h ) {
1476+ Browser . resizeListeners . push ( ( w , h ) => {
14751477 if ( ! SDL . settingVideoMode ) {
14761478 SDL . receiveEvent ( {
14771479 type : 'resize' ,
@@ -2056,10 +2058,8 @@ var LibrarySDL = {
20562058 } ,
20572059
20582060 SDL_PumpEvents__proxy : 'sync' ,
2059- SDL_PumpEvents : function ( ) {
2060- SDL . events . forEach ( function ( event ) {
2061- SDL . handleEvent ( event ) ;
2062- } ) ;
2061+ SDL_PumpEvents : function ( ) {
2062+ SDL . events . forEach ( SDL . handleEvent ) ;
20632063 } ,
20642064
20652065 // An Emscripten-specific extension to SDL: Some browser APIs require that they are called from within an event handler function.
@@ -2205,7 +2205,7 @@ var LibrarySDL = {
22052205 var x = _malloc ( { { { getNativeTypeSize ( 'i32' ) } } } ) ;
22062206 var y = _malloc ( { { { getNativeTypeSize ( 'i32' ) } } } ) ;
22072207 var comp = _malloc ( { { { getNativeTypeSize ( 'i32' ) } } } ) ;
2208- addCleanup ( function ( ) {
2208+ addCleanup ( ( ) => {
22092209 _free ( x ) ;
22102210 _free ( y ) ;
22112211 _free ( comp ) ;
@@ -2247,7 +2247,7 @@ var LibrarySDL = {
22472247 if ( raw === null ) err ( 'Trying to reuse preloaded image, but freePreloadedMediaOnUse is set!' ) ;
22482248#if STB_IMAGE
22492249 var name = stringToNewUTF8 ( filename ) ;
2250- addCleanup ( function ( ) {
2250+ addCleanup ( ( ) => {
22512251 _free ( name ) ;
22522252 } ) ;
22532253 raw = callStbImage ( 'stbi_load' , [ name ] ) ;
@@ -2448,9 +2448,7 @@ var LibrarySDL = {
24482448 } ;
24492449 Asyncify . sleepCallbacks . push ( sleepCallback ) ;
24502450 SDL . audio . callbackRemover = ( ) => {
2451- Asyncify . sleepCallbacks = Asyncify . sleepCallbacks . filter ( function ( callback ) {
2452- return callback !== sleepCallback ;
2453- } ) ;
2451+ Asyncify . sleepCallbacks = Asyncify . sleepCallbacks . filter ( ( callback ) => callback !== sleepCallback ) ;
24542452 }
24552453#endif
24562454
@@ -2771,7 +2769,7 @@ var LibrarySDL = {
27712769 var onDecodeComplete = ( data ) => {
27722770 webAudio . decodedBuffer = data ;
27732771 // Call all handlers that were waiting for this decode to finish, and clear the handler list.
2774- webAudio . onDecodeComplete . forEach ( function ( e ) { e ( ) ; } ) ;
2772+ webAudio . onDecodeComplete . forEach ( ( e ) => e ( ) ) ;
27752773 webAudio . onDecodeComplete = undefined ; // Don't allow more callback handlers since audio has finished decoding.
27762774 } ;
27772775 SDL . audioContext [ 'decodeAudioData' ] ( arrayBuffer , onDecodeComplete ) ;
@@ -2887,7 +2885,7 @@ var LibrarySDL = {
28872885 audio . numChannels = info . audio . numChannels ;
28882886 audio . frequency = info . audio . frequency ;
28892887 }
2890- audio [ 'onended' ] = function SDL_audio_onended ( ) { // TODO: cache these
2888+ audio [ 'onended' ] = function ( ) { // TODO: cache these
28912889 if ( channelInfo . audio == this ) { channelInfo . audio . paused = true ; channelInfo . audio = null ; }
28922890 if ( SDL . channelFinished ) { { { makeDynCall ( 'vi' , 'SDL.channelFinished' ) } } } ( channel ) ;
28932891 }
0 commit comments