Package Exports
- @cool-blue/brout
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@cool-blue/brout) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
stdout and stderr for browsers
Installs process.stdout and process.stderr and redirects console like
node.
Repository: https://github.com/mantoni/brout.js
Install with npm
npm install broutUsage
Assume my-script.js contains this:
process.stdout.write('Hello stdout!\n');
console.log('Hello %s!', 'console');Use with browserify and phantomic:
$ browserify -t brout my-script.js | phantomic
Hello stdout!
Hello console!API
var brout = require('brout');
brout.on('out', function (str)) {
// ...
});
brout.on('err', function (str)) {
// ...
});
brout.on('exit', function (code)) {
// ...
});Event listeners are tiggered by these calls:
process.stdout.write(string)process.stderr.write(string)process.exit(code)
The console functions log, info, warn and error get replaced and the
original implementation is exposed:
console.log.originalconsole.info.originalconsole.warn.originalconsole.error.original
The console override behaves like node's implementation and writes to
process.stdout and process.sterr.
If an out or err listener is installed, then the corresponding console
message is no longer forwarded to the original console implementation.
License
MIT