Created
September 19, 2014 12:19
-
-
Save stuf/a77a9509c0912b162898 to your computer and use it in GitHub Desktop.
Generic console object shim for older browsers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var _ = require('underscore'); | |
module.exports = function () { | |
var noop = function () {}; | |
var args = [ | |
"log", "info", "warn", "error", "debug", "trace", "dir", "group", "groupCollapsed", | |
"groupEnd", "time", "timeEnd", "profile", "profileEnd", "dirxml", "assert", | |
"count", "markTimeline", "timeStamp", "clear" | |
]; | |
if (!('console' in window)) window.console = {}; | |
_.each(args, function (arg) { | |
if (window.console[arg] == null) | |
window.console[arg] = noop; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment