Fix #816; remove references to valueWindow (#817)
[dygraphs.git] / src / polyfills / console.js
CommitLineData
a14ed8aa
DV
1// Console-polyfill. MIT license.
2// https://github.com/paulmillr/console-polyfill
3// Make it safe to do console.log() always.
9d79fed9 4(function(global) {
a14ed8aa 5 'use strict';
9d79fed9
DV
6 global.console = global.console || {};
7 var con = global.console;
a14ed8aa
DV
8 var prop, method;
9 var empty = {};
10 var dummy = function() {};
11 var properties = 'memory'.split(',');
12 var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' +
13 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' +
14 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',');
9d79fed9
DV
15 while (prop = properties.pop()) if (!con[prop]) con[prop] = empty;
16 while (method = methods.pop()) if (!con[method]) con[method] = dummy;
17})(typeof window === 'undefined' ? this : window);
18// Using `this` for web workers while maintaining compatibility with browser
19// targeted script loaders such as Browserify or Webpack where the only way to
20// get to the global object is via `window`.