File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,5 +82,33 @@ export function createEmscriptenConfig(config, wasmFile) {
8282 } ,
8383 ...userPreRun ] ;
8484 }
85+ {
86+ const print = config ?. print ;
87+ if ( print != null ) {
88+ if ( typeof print !== 'function' ) {
89+ throw new Error ( `config.print must be a function, if provided` ) ;
90+ }
91+ // Wrap the user-provided config.print() function in another
92+ // function to ensure that we control the function signature
93+ // that is provided to the final emscriptenConfig object.
94+ emscriptenConfig . print = ( text ) => {
95+ print ( text ) ;
96+ } ;
97+ }
98+ }
99+ {
100+ const printErr = config ?. printErr ;
101+ if ( printErr != null ) {
102+ if ( typeof printErr !== 'function' ) {
103+ throw new Error ( `config.printErr must be a function, if provided` ) ;
104+ }
105+ // Wrap the user-provided config.printErr() function in another
106+ // function to ensure that we control the function signature
107+ // that is provided to the final emscriptenConfig object.
108+ emscriptenConfig . printErr = ( text ) => {
109+ printErr ( text ) ;
110+ } ;
111+ }
112+ }
85113 return emscriptenConfig ;
86114}
You can’t perform that action at this time.
0 commit comments