GithubHelp home page GithubHelp logo

isabella232 / console-polyfill-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gskinner/console-polyfill

0.0 0.0 0.0 6 KB

Simple console polyfill that enables features like time/timeEnd, group/groupEnd, count, and assert in browsers that don't support them.

License: MIT License

JavaScript 82.73% HTML 17.27%

console-polyfill-1's Introduction

console-polyfill

Simple console polyfill for all console methods.

These console methods are assigned an empty function if they do not exist: log, profile, profileEnd, timeStamp, trace

These are aliased to console.log if they do not exist: debug, info, warn, error, dir, dirxml

These are defined with appropriate functionality if they do not exist (see below for more details): group, groupCollapsed, groupEnd, time, timeEnd, assert, count, clear

Note that some browsers may define console methods without fully implementing them (ex. console.group in FireFox 28).

testing

If you would like to test the injected methods, you can set the "test" variable to true in console.js.

console_deploy

The included console_deploy.js file assigns an empty function to all of the above methods. You can point to console.js during debug, and point your minifier to console_deploy.js for deployment.

While this is an easy way to prevent console output from being exposed in your production deployment, it is preferable to completely strip console calls from deployment code.

clear

If the browser does not support console.clear, it will be defined to log a visual break of six empty lines instead.

group, groupCollapsed, groupEnd

If the browser does not support console.group, it will be defined with a method that provides output visually separated into groups. It does not indent child items in order to preserve specialized console formatting and improve performance.

time, timeEnd, count, assert

If the browser does not support these methods, they are defined with methods that provide the functionality as expected, including using high precision timing when available for time/timeEnd.

console-polyfill-1's People

Contributors

gskinner avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.