12

more universal debugging with console

 3 years ago
source link: https://www.otsukare.info/2010/11/29/console-debug
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
more universal debugging with consoleotsukare Thoughts after a day of work

more universal debugging with console

Lun 29 novembre 2010by Karl Dubost (Worked at Opera from 2010 to 2013)

Rob Campbell gives a neat way to debug without being specific to one type of debugging tool.

A better way is to test for each function you want to use:

if ("console" in window && "time" in window.console)
    // define your method

\ This has the benefit of not coding for one particular type of debugging tool, will allow for graceful fallback in the event that your feature is not defined and allow you to tailor your debugging around different feature sets.

update 2010-11-30: Rui Nibau is using another method.

This article is published with a CC0 license

Karl Dubost on otsukare


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK