Closed ngdangtu-vn closed 1 year ago
I think I found a better way:
// worker.js
self.Module = {}
self.Module.print = content => postMessage({ type: 'msg', content })
self.Module.printErr = content => postMessage({ type: 'err', content })
Source: https://emscripten.org/docs/api_reference/module.html#id1
For instance, when I run
git status
, it would only display message inconsole.log()
. I would like to receive the message and display it in the frontend website. For now, I have to do this trick: https://stackoverflow.com/a/52142526However, if the website has more than 1 lib and they all spill everything to console.log than it will be very trouble to filter them.
Do we have better ways for this case?