1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.reduxLogger=t():e.reduxLogger=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){r(2),e.exports=r(2)},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=t.repeat=function(e,t){return new Array(t+1).join(e)},n=t.pad=function(e,t){return r("0",t-e.toString().length)+e};t.formatTime=function(e){return n(e.getHours(),2)+":"+n(e.getMinutes(),2)+":"+n(e.getSeconds(),2)+"."+n(e.getMilliseconds(),3)},t.timer="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance:Date},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=a({},c.default,e),r=t.logger,n=t.transformer,o=t.stateTransformer,f=t.errorTransformer,l=t.predicate,s=t.logErrors,p=t.diffPredicate;if("undefined"==typeof r)return function(){return function(e){return function(t){return e(t)}}};if(n&&console.error("Option 'transformer' is deprecated, use 'stateTransformer' instead!"),e.getState&&e.dispatch)return console.error("[redux-logger] redux-logger not installed. Make sure to pass logger instance as middleware:\n\n// Logger with default options\nimport { logger } from 'redux-logger'\nconst store = createStore(\n reducer,\n applyMiddleware(logger)\n)\n\n\n// Or you can create your own logger with custom options http://bit.ly/redux-logger-options\nimport createLogger from 'redux-logger'\n\nconst logger = createLogger({\n // ...options\n});\n\nconst store = createStore(\n reducer,\n applyMiddleware(logger)\n)\n"),function(){return function(e){return function(t){return e(t)}}};var d=[];return function(e){var r=e.getState;return function(e){return function(n){if("function"==typeof l&&!l(r,n))return e(n);var c={};d.push(c),c.started=u.timer.now(),c.startedTime=new Date,c.prevState=o(r()),c.action=n;var h=void 0;if(s)try{h=e(n)}catch(e){c.error=f(e)}else h=e(n);c.took=u.timer.now()-c.started,c.nextState=o(r());var g=t.diff&&"function"==typeof p?p(r,n):t.diff;if((0,i.printBuffer)(d,a({},t,{diff:g})),d.length=0,c.error)throw c.error;return h}}}}Object.defineProperty(t,"__esModule",{value:!0}),t.logger=t.defaults=void 0;var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=r(3),u=r(1),f=r(4),c=n(f),l=o();t.defaults=c.default,t.logger=l,t.default=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(e,t,r,n){switch("undefined"==typeof e?"undefined":f(e)){case"object":return"function"==typeof e[n]?e[n].apply(e,o(r)):e[n];case"function":return e(t);default:return e}}function i(e){var t=e.timestamp,r=e.duration;return function(e,n,o){var a=["action"];return a.push("%c"+String(e.type)),t&&a.push("%c@ "+n),r&&a.push("%c(in "+o.toFixed(2)+" ms)"),a.join(" ")}}function u(e,t){var r=t.logger,n=t.actionTransformer,o=t.titleFormatter,u=void 0===o?i(t):o,f=t.collapsed,l=t.colors,p=t.level,d=t.diff;e.forEach(function(o,i){var h=o.started,g=o.startedTime,y=o.action,v=o.prevState,b=o.error,m=o.took,x=o.nextState,w=e[i+1];w&&(x=w.prevState,m=w.started-h);var j=n(y),S="function"==typeof f?f(function(){return x},y,o):f,k=(0,c.formatTime)(g),A=l.title?"color: "+l.title(j)+";":"",D=["color: gray; font-weight: lighter;"];D.push(A),t.timestamp&&D.push("color: gray; font-weight: lighter;"),t.duration&&D.push("color: gray; font-weight: lighter;");var O=u(j,k,m);try{S?l.title?r.groupCollapsed.apply(r,["%c "+O].concat(D)):r.groupCollapsed(O):l.title?r.group.apply(r,["%c "+O].concat(D)):r.group(O)}ca
|