@@ -30,23 +30,33 @@ mergeInto(LibraryManager.library, {
3030
3131 mp_js_ticks_ms : ( ) => Date . now ( ) - MP_JS_EPOCH ,
3232
33- mp_js_hook : function ( ) {
33+ mp_js_hook : ( ) => {
3434 if ( ENVIRONMENT_IS_NODE ) {
35- var mp_interrupt_char = Module . ccall ( 'mp_hal_get_interrupt_char' , 'number' , [ 'number' ] , [ 'null' ] ) ;
36- var fs = require ( 'fs' ) ;
35+ const mp_interrupt_char = Module . ccall (
36+ "mp_hal_get_interrupt_char" ,
37+ "number" ,
38+ [ "number" ] ,
39+ [ "null" ] ,
40+ ) ;
41+ const fs = require ( "fs" ) ;
3742
38- var buf = Buffer . alloc ( 1 ) ;
43+ const buf = Buffer . alloc ( 1 ) ;
3944 try {
40- var n = fs . readSync ( process . stdin . fd , buf , 0 , 1 ) ;
45+ const n = fs . readSync ( process . stdin . fd , buf , 0 , 1 ) ;
4146 if ( n > 0 ) {
42- if ( buf [ 0 ] == mp_interrupt_char ) {
43- Module . ccall ( 'mp_sched_keyboard_interrupt' , 'null' , [ 'null' ] , [ 'null' ] ) ;
47+ if ( buf [ 0 ] === mp_interrupt_char ) {
48+ Module . ccall (
49+ "mp_sched_keyboard_interrupt" ,
50+ "null" ,
51+ [ "null" ] ,
52+ [ "null" ] ,
53+ ) ;
4454 } else {
4555 process . stdout . write ( String . fromCharCode ( buf [ 0 ] ) ) ;
4656 }
4757 }
4858 } catch ( e ) {
49- if ( e . code === ' EAGAIN' ) {
59+ if ( e . code === " EAGAIN" ) {
5060 } else {
5161 throw e ;
5262 }
0 commit comments