petersalomonsen/wasm-git

Recommend pratice for getting git message?

Closed this issue · 1 comments

For instance, when I run git status, it would only display message in console.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/52142526

However, 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?

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