0.0.1 • Published 3 years ago

custom-js-console v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Custom JS Console

create your own custom console just like codepen codesandbox etc

Node Version License Min Size build semantic-release code style: prettier

Installation

npm install custom-js-console --save
yarn add custom-js-console
<!--Minified Version-->
<script src="https://unpkg.com/custom-js-console"></script>
<!-- UnMinified Version-->
<script src="https://unpkg.com/custom-js-console/dist/index.umd.js"></script>

Import

import customConsole from 'custom-js-console';
// Common JS
const customConsole = require('custom-js-console');
customConsole;

Note

If customConsole is initialized twice then first one will be overridden

Usage

const { options, originalConsole } = new customConsole({
	log: (message, ...optionalParams) => {
		// Called When console.log is called
		alert('Console.log Called');
	},
	warn: (message, ...optionalParams) => {
		// Called When console.warn is called
		alert('Console.warn Called');
	},
	error: (message, ...optionalParams) => {
		// Called When console.error is called
		alert('Console.error Called');
	},
	info: (message, ...optionalParams) => {
		// Called When console.info is called
		alert('Console.info Called');
	},
	table: (tabularData, properties) => {
		// Called When console.table is called
		alert('Console.table Called');
		originalConsole.log(tabularData, properties); // Original Console
	},
});

Contributing

See CONTRIBUTING.md.

Bugs and Issues

If you encounter any bugs or issues, feel free to open an issue at github or email me to heetkv@gmail.com. I also always like to hear from you, if you’re using my code.