1 |
3a515b92
|
cagy
|
# console-browserify [](https://travis-ci.org/browserify/console-browserify)
|
2 |
|
|
|
3 |
|
|
Emulate console for all the browsers
|
4 |
|
|
|
5 |
|
|
## Install
|
6 |
|
|
|
7 |
|
|
You usually do not have to install `console-browserify` yourself! If your code runs in Node.js, `console` is built in. If your code runs in the browser, bundlers like [browserify](https://github.com/browserify/browserify) or [webpack](https://github.com/webpack/webpack) also include the `console-browserify` module when you do `require('console')`.
|
8 |
|
|
|
9 |
|
|
But if none of those apply, with npm do:
|
10 |
|
|
|
11 |
|
|
```
|
12 |
|
|
npm install console-browserify
|
13 |
|
|
```
|
14 |
|
|
|
15 |
|
|
## Usage
|
16 |
|
|
|
17 |
|
|
```js
|
18 |
|
|
var console = require("console")
|
19 |
|
|
// Or when manually using console-browserify directly:
|
20 |
|
|
// var console = require("console-browserify")
|
21 |
|
|
|
22 |
|
|
console.log("hello world!")
|
23 |
|
|
```
|
24 |
|
|
|
25 |
|
|
## API
|
26 |
|
|
|
27 |
|
|
See the [Node.js Console docs](https://nodejs.org/api/console.html). `console-browserify` does not support creating new `Console` instances and does not support the Inspector-only methods.
|
28 |
|
|
|
29 |
|
|
## Contributing
|
30 |
|
|
|
31 |
|
|
PRs are very welcome! The main way to contribute to `console-browserify` is by porting features, bugfixes and tests from Node.js. Ideally, code contributions to this module are copy-pasted from Node.js and transpiled to ES5, rather than reimplemented from scratch. Matching the Node.js code as closely as possible makes maintenance simpler when new changes land in Node.js.
|
32 |
|
|
This module intends to provide exactly the same API as Node.js, so features that are not available in the core `console` module will not be accepted. Feature requests should instead be directed at [nodejs/node](https://github.com/nodejs/node) and will be added to this module once they are implemented in Node.js.
|
33 |
|
|
|
34 |
|
|
If there is a difference in behaviour between Node.js's `console` module and this module, please open an issue!
|
35 |
|
|
|
36 |
|
|
## Contributors
|
37 |
|
|
|
38 |
|
|
- Raynos
|
39 |
|
|
|
40 |
|
|
## License
|
41 |
|
|
|
42 |
|
|
[MIT](./LICENSE)
|