Created
October 30, 2015 19:34
-
-
Save orbitbot/bcf29b4b8fb0e9e24833 to your computer and use it in GitHub Desktop.
howto browserify & webpack support
This file contains hidden or 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
// Console-polyfill. MIT license. | |
// https://github.com/paulmillr/console-polyfill | |
// Make it safe to do console.log() always. | |
(function(global) { | |
'use strict'; | |
global.console = global.console || {}; | |
var con = global.console; | |
var prop, method; | |
var empty = {}; | |
var dummy = function() {}; | |
var properties = 'memory'.split(','); | |
var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' + | |
'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + | |
'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(','); | |
while (prop = properties.pop()) if (!con[prop]) con[prop] = empty; | |
while (method = methods.pop()) if (typeof con[method] !== 'function') con[method] = dummy; | |
})(typeof window === 'undefined' ? this : window); | |
// Using `this` for web workers while maintaining compatibility with browser | |
// targeted script loaders such as Browserify or Webpack where the only way to | |
// get to the global object is via `window`. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment