This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconsole-shim.min.js.map
1 lines (1 loc) · 2.53 KB
/
console-shim.min.js.map
1
{"version":3,"file":null,"sources":["console-shim.es6.js"],"sourcesContent":["// https://github.com/liamnewmarch/console-shim 2014 CC-BY @liamnewmarch\n\n\nconst methodsToShim = [\n 'assert',\n 'count',\n 'debug',\n 'dir',\n 'dirxml',\n 'error',\n 'exception',\n 'info',\n 'log',\n 'table',\n 'trace',\n 'warn',\n];\n\n\nconst methodsToIgnore = [\n 'clear',\n 'count',\n 'group',\n 'groupCollapsed',\n 'groupEnd',\n 'profile',\n 'profileEnd',\n 'timeStamp',\n];\n\n\n/**\n* ConsoleShim class.\n*/\nclass ConsoleShim {\n\n /**\n * @constructor\n */\n constructor() {\n this.__buffer = [];\n this.__mapMethods();\n this.__watchForConsole();\n }\n\n /**\n * @param {...*} args Value to buffer.\n * @private\n */\n __addMethod(key) {\n return (...args) => this.__buffer.push(key, args);\n }\n\n /**\n * @param {string} method Method to call.\n * @param {array} args Args to pass to method.\n */\n __callNativeMethod(method, args) {\n method = method in window.console || 'log';\n window.console.log(...args);\n }\n\n /**\n * @private\n */\n __mapMethods() {\n const noop = function() {/* noop */};\n methodsToShim.forEach(key => this[key] = this.__addMethod(key));\n methodsToIgnore.forEach(key => this[key] = noop);\n }\n\n /**\n * @private\n */\n __watchForConsole() {\n if (window.console instanceof ConsoleShim) {\n return;\n }\n\n if ('check' in this) {\n clearTimeout(check);\n }\n\n this.__buffer.forEach(args => {\n this.__logToConsole(...args);\n });\n\n this.check = setTimeout(this.__watchForConsole, 1000);\n }\n}\n\n\n/**\n* ConsoleShim instance.\n*/\nexport default new ConsoleShim();\n"],"names":["const","methodsToShim","methodsToIgnore","ConsoleShim","this","__buffer","__mapMethods","__watchForConsole","key","push","args","method","window","console","log","ref","noop","forEach","__addMethod","clearTimeout","check","__logToConsole","setTimeout"],"mappings":"mCAGAA,IAAMC,IACJ,SACA,QACA,QACA,MACA,SACA,QACA,YACA,OACA,MACA,QACA,QACA,QAIIC,GACJ,QACA,QACA,QACA,iBACA,WACA,UACA,aACA,aAOIC,EAAY,WAMhBC,KAAOC,YACPD,KAAOE,eACPF,KAAOG,oBAOTJ,kCAAcK,aACZ,OAAS,yEAAaJ,GAAKC,SAASI,KAAKD,EAAKE,KAOhDP,wCAAqBQ,EAAQD,GAC3BC,EAAWA,IAAUC,QAAOC,SAAW,KACvC,OAAED,OAAOC,UAAQC,UAAIC,EAAAL,IAMvBP,+CACUa,EAAO,YACff,GAAgBgB,QAAQ,SAAAT,SAAOJ,GAAKI,GAAOJ,EAAKc,YAAYV,KAC5DN,EAAkBe,QAAQ,SAAAT,SAAOJ,GAAKI,GAAOQ,KAM/Cb,mDACQS,QAAOC,kBAAmBV,KAI1B,SAAWC,OACfe,aAAeC,OAGjBhB,KAAOC,SAASY,QAAQ,SAAAP,GACtB,MAAEN,IAAKiB,qBAAeN,EAAAL,KAGxBN,KAAOgB,MAAQE,WAAWlB,KAAKG,kBAAmB,aAQrC,GAAIJ"}