react-component-timing
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e){t.exports=void 0},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),i=o.createContext({onLoad:function(t){return null}}),a=i.Provider,u=i.Consumer;e.RootConsumer=u;var s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.onLoad=function(t){e.props.reporter(t)},e}return r(e,t),e.prototype.render=function(){return o.createElement(a,{value:{onLoad:this.onLoad}},this.props.children)},e}(o.Component);e.ComponentTimingRoot=s},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),o=this&&this.__assign||Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t};Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(1),u=i.createContext({informParentOfChildLoad:function(){return null},registerWithParent:function(){return null},unregisterWithParent:function(){return null}}),s=u.Provider,p=u.Consumer,c=function(t){function e(e){var n=t.call(this,e)||this;return n.onChildLoad=function(t,e){var r;n.setState({loadingStates:o({},n.state.loadingStates,(r={},r[t]=e,r))})},n.onChildRegister=function(t){},n.onChildUnregister=function(t){},n.onRender=function(t,e){var r=n.isLoaded,o=n.checkLoaded();!r&&o?(e.informParentOfChildLoad(n.props.id,o),n.stopTiming(),t.onLoad({event:"load",id:n.props.id,time:n.getMostRecentTime()})):r&&!o&&(e.informParentOfChildLoad(n.props.id,o),n.startTiming()),n.isLoaded=o},n.isLoaded=!0,n.isRegistered=!1,n.unregisterWithParent=function(){return null},n.state={loadingStates:{}},n}return r(e,t),e.prototype.componentWillUnmount=function(){this.unregisterWithParent(this.props.id)},e.prototype.render=function(){var t=this;return i.createElement(a.RootConsumer,null,function(e){return i.createElement(p,null,function(n){return t.isRegistered||(n.registerWithParent(t.props.id),t.unregisterWithParent=n.unregisterWithParent,t.isRegistered=!0),t.onRender(e,n),i.createElement(s,{value:{informParentOfChildLoad:t.onChildLoad,registerWithParent:t.onChildRegister,unregisterWithParent:t.onChildUnregister}},t.props.children)})})},e.prototype.checkLoaded=function(){return this.props.isLoaded(this.state.loadingStates)},e.prototype.startTiming=function(){window.performance.mark(this.getStartMarkName())},e.prototype.stopTiming=function(){window.performance.mark(this.getEndMarkName()),window.performance.measure(this.getMeasureName(),this.getStartMarkName(),this.getEndMarkName())},e.prototype.getMostRecentTime=function(){var t=window.performance.getEntriesByName(this.getMeasureName(),"measure");return t[t.length-1].duration},e.prototype.getStartMarkName=function(){return this.props.id+"-load-start"},e.prototype.getEndMarkName=function(){return this.props.id+"-load-end"},e.prototype.getMeasureName=function(){return this.props.id+"-loading-time"},e}(i.Component);e.ComponentTiming=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1);e.ComponentTimingRoot=r.ComponentTimingRoot;var o=n(2);e.ComponentTiming=o.ComponentTiming}]); | ||
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e){t.exports=React},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),i=o.createContext({onLoad:function(t){return null}}),a=i.Provider,u=i.Consumer;e.RootConsumer=u;var s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.onLoad=function(t){e.props.reporter(t)},e}return r(e,t),e.prototype.render=function(){return o.createElement(a,{value:{onLoad:this.onLoad}},this.props.children)},e}(o.Component);e.ComponentTimingRoot=s},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),o=this&&this.__assign||Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t};Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(1),u=i.createContext({informParentOfChildLoad:function(){return null},registerWithParent:function(){return null},unregisterWithParent:function(){return null}}),s=u.Provider,p=u.Consumer,c=function(t){function e(e){var n=t.call(this,e)||this;return n.onChildLoad=function(t,e){var r;n.setState({loadingStates:o({},n.state.loadingStates,(r={},r[t]=e,r))})},n.onChildRegister=function(t){},n.onChildUnregister=function(t){},n.onRender=function(t,e){var r=n.isLoaded,o=n.checkLoaded();!r&&o?(e.informParentOfChildLoad(n.props.id,o),n.stopTiming(),t.onLoad({event:"load",id:n.props.id,time:n.getMostRecentTime()})):r&&!o&&(e.informParentOfChildLoad(n.props.id,o),n.startTiming()),n.isLoaded=o},n.isLoaded=!0,n.isRegistered=!1,n.unregisterWithParent=function(){return null},n.state={loadingStates:{}},n}return r(e,t),e.prototype.componentWillUnmount=function(){this.unregisterWithParent(this.props.id)},e.prototype.render=function(){var t=this;return i.createElement(a.RootConsumer,null,function(e){return i.createElement(p,null,function(n){return t.isRegistered||(n.registerWithParent(t.props.id),t.unregisterWithParent=n.unregisterWithParent,t.isRegistered=!0),t.onRender(e,n),i.createElement(s,{value:{informParentOfChildLoad:t.onChildLoad,registerWithParent:t.onChildRegister,unregisterWithParent:t.onChildUnregister}},t.props.children)})})},e.prototype.checkLoaded=function(){return this.props.isLoaded(this.state.loadingStates)},e.prototype.startTiming=function(){window.performance.mark(this.getStartMarkName())},e.prototype.stopTiming=function(){window.performance.mark(this.getEndMarkName()),window.performance.measure(this.getMeasureName(),this.getStartMarkName(),this.getEndMarkName())},e.prototype.getMostRecentTime=function(){var t=window.performance.getEntriesByName(this.getMeasureName(),"measure");return t[t.length-1].duration},e.prototype.getStartMarkName=function(){return this.props.id+"-load-start"},e.prototype.getEndMarkName=function(){return this.props.id+"-load-end"},e.prototype.getMeasureName=function(){return this.props.id+"-loading-time"},e}(i.Component);e.ComponentTiming=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1);e.ComponentTimingRoot=r.ComponentTimingRoot;var o=n(2);e.ComponentTiming=o.ComponentTiming}]); | ||
//# sourceMappingURL=bundle.js.map |
{ | ||
"name": "react-component-timing", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Monitor performance at a per component level", | ||
@@ -5,0 +5,0 @@ "main": "dist/bundle.js", |
@@ -24,17 +24,5 @@ module.exports = { | ||
externals: { | ||
react: { | ||
root: "React", | ||
commonjs2: "react", | ||
commonjs: "react", | ||
amd: "react", | ||
umd: "react" | ||
}, | ||
"react-dom": { | ||
root: "ReactDOM", | ||
commonjs2: "react-dom", | ||
commonjs: "react-dom", | ||
amd: "react-dom", | ||
umd: "react-dom" | ||
} | ||
react: "React", | ||
"react-dom": "ReactDOM" | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
74226
-0.47%640
-1.84%