0.1.1 • Published 7 years ago

js-console-consumers v0.1.1

Weekly downloads
7
License
-
Repository
-
Last release
7 years ago

js-console-consumers

Wraps JavaScript's console object to notify "consumers" about log/warn/... calls. Also installs handlers for window error and unhandledrejection events and calls consumer.error() accordingly.

Usage

import { prepareConsole } from "js-console-consumers";

prepareConsole(console);

let consumer = {log: s => window.alert("log: " + s), error: s => window.alert("error: " + s)};
console.addConsumer(c);
console.log("Hello"); // alert pops up!

// to uninstall:
console.removeConsumer(c);

License

MIT

0.1.1

7 years ago

0.1.0

7 years ago