| 1 | // Console-polyfill. MIT license. |
| 2 | // https://github.com/paulmillr/console-polyfill |
| 3 | // Make it safe to do console.log() always. |
| 4 | (function(global) { |
| 5 | 'use strict'; |
| 6 | global.console = global.console || {}; |
| 7 | var con = global.console; |
| 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(','); |
| 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`. |