@skele/classic
Version:
Skele is an architectural framework that assists with building data-driven apps with React or React Native.
1 lines • 880 B
JavaScript
;Object.defineProperty(exports,"__esModule",{value:true});exports.time=time;exports.timeSync=timeSync;function time(note,fn){if(process.env.SKELE_PROFILING!=='enable'){return fn;}return function _callee(){var start,result,end,_args=arguments;return regeneratorRuntime.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:start=Date.now();_context.next=3;return regeneratorRuntime.awrap(fn.apply(void 0,_args));case 3:result=_context.sent;end=Date.now();console.log(note+" took "+(end-start)+" ms");return _context.abrupt("return",result);case 7:case"end":return _context.stop();}}},null,this);};}function timeSync(note,fn){if(process.env.SKELE_PROFILING!=='enable'){return fn;}return function(){var start=Date.now();var result=fn.apply(void 0,arguments);var end=Date.now();console.log(note+" took "+(end-start)+" ms");return result;};}