@@ -2009,9 +2009,7 @@ function getUniqueRunDependency(id) {
2009
2009
function addRunDependency ( id ) {
2010
2010
runDependencies ++ ;
2011
2011
2012
- if ( Module [ 'monitorRunDependencies' ] ) {
2013
- Module [ 'monitorRunDependencies' ] ( runDependencies ) ;
2014
- }
2012
+ Module [ 'monitorRunDependencies' ] ?. ( runDependencies ) ;
2015
2013
2016
2014
if ( id ) {
2017
2015
assert ( ! runDependencyTracking [ id ] ) ;
@@ -2045,9 +2043,7 @@ function addRunDependency(id) {
2045
2043
function removeRunDependency ( id ) {
2046
2044
runDependencies -- ;
2047
2045
2048
- if ( Module [ 'monitorRunDependencies' ] ) {
2049
- Module [ 'monitorRunDependencies' ] ( runDependencies ) ;
2050
- }
2046
+ Module [ 'monitorRunDependencies' ] ?. ( runDependencies ) ;
2051
2047
2052
2048
if ( id ) {
2053
2049
assert ( runDependencyTracking [ id ] ) ;
@@ -2070,9 +2066,7 @@ function removeRunDependency(id) {
2070
2066
2071
2067
/** @param {string|number= } what */
2072
2068
function abort ( what ) {
2073
- if ( Module [ 'onAbort' ] ) {
2074
- Module [ 'onAbort' ] ( what ) ;
2075
- }
2069
+ Module [ 'onAbort' ] ?. ( what ) ;
2076
2070
2077
2071
what = 'Aborted(' + what + ')' ;
2078
2072
// TODO(sbc): Should we remove printing and leave it up to whoever
@@ -2476,7 +2470,7 @@ function dbg(text) {
2476
2470
}
2477
2471
2478
2472
var warnOnce = ( text ) => {
2479
- if ( ! warnOnce . shown ) warnOnce . shown = { } ;
2473
+ warnOnce . shown || = { } ;
2480
2474
if ( ! warnOnce . shown [ text ] ) {
2481
2475
warnOnce . shown [ text ] = 1 ;
2482
2476
if ( ENVIRONMENT_IS_NODE ) text = 'warning: ' + text ;
@@ -3024,55 +3018,53 @@ function dbg(text) {
3024
3018
// no supported
3025
3019
throw new FS . ErrnoError ( 63 ) ;
3026
3020
}
3027
- if ( ! MEMFS . ops_table ) {
3028
- MEMFS . ops_table = {
3029
- dir : {
3030
- node : {
3031
- getattr : MEMFS . node_ops . getattr ,
3032
- setattr : MEMFS . node_ops . setattr ,
3033
- lookup : MEMFS . node_ops . lookup ,
3034
- mknod : MEMFS . node_ops . mknod ,
3035
- rename : MEMFS . node_ops . rename ,
3036
- unlink : MEMFS . node_ops . unlink ,
3037
- rmdir : MEMFS . node_ops . rmdir ,
3038
- readdir : MEMFS . node_ops . readdir ,
3039
- symlink : MEMFS . node_ops . symlink
3040
- } ,
3041
- stream : {
3042
- llseek : MEMFS . stream_ops . llseek
3043
- }
3021
+ MEMFS . ops_table ||= {
3022
+ dir : {
3023
+ node : {
3024
+ getattr : MEMFS . node_ops . getattr ,
3025
+ setattr : MEMFS . node_ops . setattr ,
3026
+ lookup : MEMFS . node_ops . lookup ,
3027
+ mknod : MEMFS . node_ops . mknod ,
3028
+ rename : MEMFS . node_ops . rename ,
3029
+ unlink : MEMFS . node_ops . unlink ,
3030
+ rmdir : MEMFS . node_ops . rmdir ,
3031
+ readdir : MEMFS . node_ops . readdir ,
3032
+ symlink : MEMFS . node_ops . symlink
3044
3033
} ,
3045
- file : {
3046
- node : {
3047
- getattr : MEMFS . node_ops . getattr ,
3048
- setattr : MEMFS . node_ops . setattr
3049
- } ,
3050
- stream : {
3051
- llseek : MEMFS . stream_ops . llseek ,
3052
- read : MEMFS . stream_ops . read ,
3053
- write : MEMFS . stream_ops . write ,
3054
- allocate : MEMFS . stream_ops . allocate ,
3055
- mmap : MEMFS . stream_ops . mmap ,
3056
- msync : MEMFS . stream_ops . msync
3057
- }
3058
- } ,
3059
- link : {
3060
- node : {
3061
- getattr : MEMFS . node_ops . getattr ,
3062
- setattr : MEMFS . node_ops . setattr ,
3063
- readlink : MEMFS . node_ops . readlink
3064
- } ,
3065
- stream : { }
3034
+ stream : {
3035
+ llseek : MEMFS . stream_ops . llseek
3036
+ }
3037
+ } ,
3038
+ file : {
3039
+ node : {
3040
+ getattr : MEMFS . node_ops . getattr ,
3041
+ setattr : MEMFS . node_ops . setattr
3066
3042
} ,
3067
- chrdev : {
3068
- node : {
3069
- getattr : MEMFS . node_ops . getattr ,
3070
- setattr : MEMFS . node_ops . setattr
3071
- } ,
3072
- stream : FS . chrdev_stream_ops
3043
+ stream : {
3044
+ llseek : MEMFS . stream_ops . llseek ,
3045
+ read : MEMFS . stream_ops . read ,
3046
+ write : MEMFS . stream_ops . write ,
3047
+ allocate : MEMFS . stream_ops . allocate ,
3048
+ mmap : MEMFS . stream_ops . mmap ,
3049
+ msync : MEMFS . stream_ops . msync
3073
3050
}
3074
- } ;
3075
- }
3051
+ } ,
3052
+ link : {
3053
+ node : {
3054
+ getattr : MEMFS . node_ops . getattr ,
3055
+ setattr : MEMFS . node_ops . setattr ,
3056
+ readlink : MEMFS . node_ops . readlink
3057
+ } ,
3058
+ stream : { }
3059
+ } ,
3060
+ chrdev : {
3061
+ node : {
3062
+ getattr : MEMFS . node_ops . getattr ,
3063
+ setattr : MEMFS . node_ops . setattr
3064
+ } ,
3065
+ stream : FS . chrdev_stream_ops
3066
+ }
3067
+ } ;
3076
3068
var node = FS . createNode ( parent , name , mode , dev ) ;
3077
3069
if ( FS . isDir ( node . mode ) ) {
3078
3070
node . node_ops = MEMFS . ops_table . dir . node ;
@@ -3215,10 +3207,7 @@ function dbg(text) {
3215
3207
} ,
3216
3208
readdir ( node ) {
3217
3209
var entries = [ '.' , '..' ] ;
3218
- for ( var key in node . contents ) {
3219
- if ( ! node . contents . hasOwnProperty ( key ) ) {
3220
- continue ;
3221
- }
3210
+ for ( var key of Object . keys ( node . contents ) ) {
3222
3211
entries . push ( key ) ;
3223
3212
}
3224
3213
return entries ;
@@ -3393,15 +3382,15 @@ function dbg(text) {
3393
3382
var dep = getUniqueRunDependency ( `cp ${ fullname } ` ) ; // might have several active requests for the same fullname
3394
3383
function processData ( byteArray ) {
3395
3384
function finish ( byteArray ) {
3396
- if ( preFinish ) preFinish ( ) ;
3385
+ preFinish ?. ( ) ;
3397
3386
if ( ! dontCreateFile ) {
3398
3387
FS_createDataFile ( parent , name , byteArray , canRead , canWrite , canOwn ) ;
3399
3388
}
3400
- if ( onload ) onload ( ) ;
3389
+ onload ?. ( ) ;
3401
3390
removeRunDependency ( dep ) ;
3402
3391
}
3403
3392
if ( FS_handledByPreloadPlugin ( byteArray , fullname , finish , ( ) => {
3404
- if ( onerror ) onerror ( ) ;
3393
+ onerror ?. ( ) ;
3405
3394
removeRunDependency ( dep ) ;
3406
3395
} ) ) {
3407
3396
return ;
@@ -4017,9 +4006,7 @@ function dbg(text) {
4017
4006
// override node's stream ops with the device's
4018
4007
stream . stream_ops = device . stream_ops ;
4019
4008
// forward the open call
4020
- if ( stream . stream_ops . open ) {
4021
- stream . stream_ops . open ( stream ) ;
4022
- }
4009
+ stream . stream_ops . open ?. ( stream ) ;
4023
4010
} ,
4024
4011
llseek ( ) {
4025
4012
throw new FS . ErrnoError ( 70 ) ;
@@ -5041,7 +5028,7 @@ function dbg(text) {
5041
5028
} ,
5042
5029
close ( stream ) {
5043
5030
// flush any pending line data
5044
- if ( output && output . buffer && output . buffer . length ) {
5031
+ if ( output ? .buffer ? .length ) {
5045
5032
output ( 10 ) ;
5046
5033
}
5047
5034
} ,
@@ -6087,7 +6074,7 @@ function dbg(text) {
6087
6074
try {
6088
6075
6089
6076
var stream = SYSCALLS . getStreamFromFD ( fd ) ;
6090
- if ( stream . stream_ops && stream . stream_ops . fsync ) {
6077
+ if ( stream . stream_ops ? .fsync ) {
6091
6078
return stream . stream_ops . fsync ( stream ) ;
6092
6079
}
6093
6080
return 0 ; // we can't do anything synchronously; the in-memory FS is already synced to
@@ -6753,6 +6740,7 @@ var missingLibrarySymbols = [
6753
6740
'registerTouchEventCallback' ,
6754
6741
'fillGamepadEventData' ,
6755
6742
'registerGamepadEventCallback' ,
6743
+ 'disableGamepadApiIfItThrows' ,
6756
6744
'registerBeforeUnloadEventCallback' ,
6757
6745
'fillBatteryEventData' ,
6758
6746
'battery' ,
@@ -6775,6 +6763,7 @@ var missingLibrarySymbols = [
6775
6763
'makePromiseCallback' ,
6776
6764
'ExceptionInfo' ,
6777
6765
'findMatchingCatch' ,
6766
+ 'Browser_asyncPrepareDataCounter' ,
6778
6767
'setMainLoop' ,
6779
6768
'getSocketFromFD' ,
6780
6769
'getSocketAddress' ,
@@ -7031,7 +7020,7 @@ function checkUnflushedContent() {
7031
7020
var stream = info . object ;
7032
7021
var rdev = stream . rdev ;
7033
7022
var tty = TTY . ttys [ rdev ] ;
7034
- if ( tty && tty . output && tty . output . length ) {
7023
+ if ( tty ? .output ? .length ) {
7035
7024
has = true ;
7036
7025
}
7037
7026
} ) ;
0 commit comments