How to use beginLifeCycleTimer method in Playwright Internal

Best JavaScript code snippet using playwright-internal

65b6bd2ffbe6e4c46a631afcc31212818c6d58ReactDebugTool.js

Source:65b6bd2ffbe6e4c46a631afcc31212818c6d58ReactDebugTool.js Github

copy

Full Screen

...87 if (!debugID) {88 warning(false, 'ReactDebugTool: debugID may not be empty.');89 }90 };91 var beginLifeCycleTimer = function beginLifeCycleTimer(debugID, timerType) {92 if (currentFlushNesting === 0) {93 return;94 }95 if (currentTimerType && !lifeCycleTimerHasWarned) {96 warning(false, 'There is an internal error in the React performance measurement code.' + '\n\nDid not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another');97 lifeCycleTimerHasWarned = true;98 }99 currentTimerStartTime = performanceNow();100 currentTimerNestedFlushDuration = 0;101 currentTimerDebugID = debugID;102 currentTimerType = timerType;103 };104 var endLifeCycleTimer = function endLifeCycleTimer(debugID, timerType) {105 if (currentFlushNesting === 0) {106 return;107 }108 if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) {109 warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another');110 lifeCycleTimerHasWarned = true;111 }112 if (_isProfiling) {113 currentFlushMeasurements.push({114 timerType: timerType,115 instanceID: debugID,116 duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration117 });118 }119 currentTimerStartTime = 0;120 currentTimerNestedFlushDuration = 0;121 currentTimerDebugID = null;122 currentTimerType = null;123 };124 var pauseCurrentLifeCycleTimer = function pauseCurrentLifeCycleTimer() {125 var currentTimer = {126 startTime: currentTimerStartTime,127 nestedFlushStartTime: performanceNow(),128 debugID: currentTimerDebugID,129 timerType: currentTimerType130 };131 lifeCycleTimerStack.push(currentTimer);132 currentTimerStartTime = 0;133 currentTimerNestedFlushDuration = 0;134 currentTimerDebugID = null;135 currentTimerType = null;136 };137 var resumeCurrentLifeCycleTimer = function resumeCurrentLifeCycleTimer() {138 var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(),139 startTime = _lifeCycleTimerStack$.startTime,140 nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime,141 debugID = _lifeCycleTimerStack$.debugID,142 timerType = _lifeCycleTimerStack$.timerType;143 var nestedFlushDuration = performanceNow() - nestedFlushStartTime;144 currentTimerStartTime = startTime;145 currentTimerNestedFlushDuration += nestedFlushDuration;146 currentTimerDebugID = debugID;147 currentTimerType = timerType;148 };149 var lastMarkTimeStamp = 0;150 var canUsePerformanceMeasure = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';151 var shouldMark = function shouldMark(debugID) {152 if (!_isProfiling || !canUsePerformanceMeasure) {153 return false;154 }155 var element = ReactComponentTreeHook.getElement(debugID);156 if (element == null || typeof element !== 'object') {157 return false;158 }159 var isHostElement = typeof element.type === 'string';160 if (isHostElement) {161 return false;162 }163 return true;164 };165 var markBegin = function markBegin(debugID, markType) {166 if (!shouldMark(debugID)) {167 return;168 }169 var markName = debugID + '::' + markType;170 lastMarkTimeStamp = performanceNow();171 performance.mark(markName);172 };173 var markEnd = function markEnd(debugID, markType) {174 if (!shouldMark(debugID)) {175 return;176 }177 var markName = debugID + '::' + markType;178 var displayName = ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown';179 var timeStamp = performanceNow();180 if (timeStamp - lastMarkTimeStamp > 0.1) {181 var measurementName = displayName + ' [' + markType + ']';182 performance.measure(measurementName, markName);183 }184 performance.clearMarks(markName);185 performance.clearMeasures(measurementName);186 };187 ReactDebugTool = {188 addHook: function addHook(hook) {189 hooks.push(hook);190 },191 removeHook: function removeHook(hook) {192 for (var i = 0; i < hooks.length; i++) {193 if (hooks[i] === hook) {194 hooks.splice(i, 1);195 i--;196 }197 }198 },199 isProfiling: function isProfiling() {200 return _isProfiling;201 },202 beginProfiling: function beginProfiling() {203 if (_isProfiling) {204 return;205 }206 _isProfiling = true;207 flushHistory.length = 0;208 resetMeasurements();209 ReactDebugTool.addHook(ReactHostOperationHistoryHook);210 },211 endProfiling: function endProfiling() {212 if (!_isProfiling) {213 return;214 }215 _isProfiling = false;216 resetMeasurements();217 ReactDebugTool.removeHook(ReactHostOperationHistoryHook);218 },219 getFlushHistory: function getFlushHistory() {220 return flushHistory;221 },222 onBeginFlush: function onBeginFlush() {223 currentFlushNesting++;224 resetMeasurements();225 pauseCurrentLifeCycleTimer();226 emitEvent('onBeginFlush');227 },228 onEndFlush: function onEndFlush() {229 resetMeasurements();230 currentFlushNesting--;231 resumeCurrentLifeCycleTimer();232 emitEvent('onEndFlush');233 },234 onBeginLifeCycleTimer: function onBeginLifeCycleTimer(debugID, timerType) {235 checkDebugID(debugID);236 emitEvent('onBeginLifeCycleTimer', debugID, timerType);237 markBegin(debugID, timerType);238 beginLifeCycleTimer(debugID, timerType);239 },240 onEndLifeCycleTimer: function onEndLifeCycleTimer(debugID, timerType) {241 checkDebugID(debugID);242 endLifeCycleTimer(debugID, timerType);243 markEnd(debugID, timerType);244 emitEvent('onEndLifeCycleTimer', debugID, timerType);245 },246 onBeginProcessingChildContext: function onBeginProcessingChildContext() {247 emitEvent('onBeginProcessingChildContext');248 },249 onEndProcessingChildContext: function onEndProcessingChildContext() {250 emitEvent('onEndProcessingChildContext');251 },252 onHostOperation: function onHostOperation(operation) {...

Full Screen

Full Screen

747110cb83c5d9948fa42e36cd4e7f19ad369eReactDebugTool.js

Source:747110cb83c5d9948fa42e36cd4e7f19ad369eReactDebugTool.js Github

copy

Full Screen

...87 if (!debugID) {88 warning(false, 'ReactDebugTool: debugID may not be empty.');89 }90 };91 var beginLifeCycleTimer = function beginLifeCycleTimer(debugID, timerType) {92 if (currentFlushNesting === 0) {93 return;94 }95 if (currentTimerType && !lifeCycleTimerHasWarned) {96 warning(false, 'There is an internal error in the React performance measurement code.' + '\n\nDid not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another');97 lifeCycleTimerHasWarned = true;98 }99 currentTimerStartTime = performanceNow();100 currentTimerNestedFlushDuration = 0;101 currentTimerDebugID = debugID;102 currentTimerType = timerType;103 };104 var endLifeCycleTimer = function endLifeCycleTimer(debugID, timerType) {105 if (currentFlushNesting === 0) {106 return;107 }108 if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) {109 warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another');110 lifeCycleTimerHasWarned = true;111 }112 if (_isProfiling) {113 currentFlushMeasurements.push({114 timerType: timerType,115 instanceID: debugID,116 duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration117 });118 }119 currentTimerStartTime = 0;120 currentTimerNestedFlushDuration = 0;121 currentTimerDebugID = null;122 currentTimerType = null;123 };124 var pauseCurrentLifeCycleTimer = function pauseCurrentLifeCycleTimer() {125 var currentTimer = {126 startTime: currentTimerStartTime,127 nestedFlushStartTime: performanceNow(),128 debugID: currentTimerDebugID,129 timerType: currentTimerType130 };131 lifeCycleTimerStack.push(currentTimer);132 currentTimerStartTime = 0;133 currentTimerNestedFlushDuration = 0;134 currentTimerDebugID = null;135 currentTimerType = null;136 };137 var resumeCurrentLifeCycleTimer = function resumeCurrentLifeCycleTimer() {138 var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(),139 startTime = _lifeCycleTimerStack$.startTime,140 nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime,141 debugID = _lifeCycleTimerStack$.debugID,142 timerType = _lifeCycleTimerStack$.timerType;143 var nestedFlushDuration = performanceNow() - nestedFlushStartTime;144 currentTimerStartTime = startTime;145 currentTimerNestedFlushDuration += nestedFlushDuration;146 currentTimerDebugID = debugID;147 currentTimerType = timerType;148 };149 var lastMarkTimeStamp = 0;150 var canUsePerformanceMeasure = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';151 var shouldMark = function shouldMark(debugID) {152 if (!_isProfiling || !canUsePerformanceMeasure) {153 return false;154 }155 var element = ReactComponentTreeHook.getElement(debugID);156 if (element == null || typeof element !== 'object') {157 return false;158 }159 var isHostElement = typeof element.type === 'string';160 if (isHostElement) {161 return false;162 }163 return true;164 };165 var markBegin = function markBegin(debugID, markType) {166 if (!shouldMark(debugID)) {167 return;168 }169 var markName = debugID + '::' + markType;170 lastMarkTimeStamp = performanceNow();171 performance.mark(markName);172 };173 var markEnd = function markEnd(debugID, markType) {174 if (!shouldMark(debugID)) {175 return;176 }177 var markName = debugID + '::' + markType;178 var displayName = ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown';179 var timeStamp = performanceNow();180 if (timeStamp - lastMarkTimeStamp > 0.1) {181 var measurementName = displayName + ' [' + markType + ']';182 performance.measure(measurementName, markName);183 }184 performance.clearMarks(markName);185 performance.clearMeasures(measurementName);186 };187 ReactDebugTool = {188 addHook: function addHook(hook) {189 hooks.push(hook);190 },191 removeHook: function removeHook(hook) {192 for (var i = 0; i < hooks.length; i++) {193 if (hooks[i] === hook) {194 hooks.splice(i, 1);195 i--;196 }197 }198 },199 isProfiling: function isProfiling() {200 return _isProfiling;201 },202 beginProfiling: function beginProfiling() {203 if (_isProfiling) {204 return;205 }206 _isProfiling = true;207 flushHistory.length = 0;208 resetMeasurements();209 ReactDebugTool.addHook(ReactHostOperationHistoryHook);210 },211 endProfiling: function endProfiling() {212 if (!_isProfiling) {213 return;214 }215 _isProfiling = false;216 resetMeasurements();217 ReactDebugTool.removeHook(ReactHostOperationHistoryHook);218 },219 getFlushHistory: function getFlushHistory() {220 return flushHistory;221 },222 onBeginFlush: function onBeginFlush() {223 currentFlushNesting++;224 resetMeasurements();225 pauseCurrentLifeCycleTimer();226 emitEvent('onBeginFlush');227 },228 onEndFlush: function onEndFlush() {229 resetMeasurements();230 currentFlushNesting--;231 resumeCurrentLifeCycleTimer();232 emitEvent('onEndFlush');233 },234 onBeginLifeCycleTimer: function onBeginLifeCycleTimer(debugID, timerType) {235 checkDebugID(debugID);236 emitEvent('onBeginLifeCycleTimer', debugID, timerType);237 markBegin(debugID, timerType);238 beginLifeCycleTimer(debugID, timerType);239 },240 onEndLifeCycleTimer: function onEndLifeCycleTimer(debugID, timerType) {241 checkDebugID(debugID);242 endLifeCycleTimer(debugID, timerType);243 markEnd(debugID, timerType);244 emitEvent('onEndLifeCycleTimer', debugID, timerType);245 },246 onBeginProcessingChildContext: function onBeginProcessingChildContext() {247 emitEvent('onBeginProcessingChildContext');248 },249 onEndProcessingChildContext: function onEndProcessingChildContext() {250 emitEvent('onEndProcessingChildContext');251 },252 onHostOperation: function onHostOperation(operation) {...

Full Screen

Full Screen

72fa9dReactDebugTool.js

Source:72fa9dReactDebugTool.js Github

copy

Full Screen

...87 if (!debugID) {88 warning(false, 'ReactDebugTool: debugID may not be empty.');89 }90 };91 var beginLifeCycleTimer = function beginLifeCycleTimer(debugID, timerType) {92 if (currentFlushNesting === 0) {93 return;94 }95 if (currentTimerType && !lifeCycleTimerHasWarned) {96 warning(false, 'There is an internal error in the React performance measurement code.' + '\n\nDid not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another');97 lifeCycleTimerHasWarned = true;98 }99 currentTimerStartTime = performanceNow();100 currentTimerNestedFlushDuration = 0;101 currentTimerDebugID = debugID;102 currentTimerType = timerType;103 };104 var endLifeCycleTimer = function endLifeCycleTimer(debugID, timerType) {105 if (currentFlushNesting === 0) {106 return;107 }108 if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) {109 warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another');110 lifeCycleTimerHasWarned = true;111 }112 if (_isProfiling) {113 currentFlushMeasurements.push({114 timerType: timerType,115 instanceID: debugID,116 duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration117 });118 }119 currentTimerStartTime = 0;120 currentTimerNestedFlushDuration = 0;121 currentTimerDebugID = null;122 currentTimerType = null;123 };124 var pauseCurrentLifeCycleTimer = function pauseCurrentLifeCycleTimer() {125 var currentTimer = {126 startTime: currentTimerStartTime,127 nestedFlushStartTime: performanceNow(),128 debugID: currentTimerDebugID,129 timerType: currentTimerType130 };131 lifeCycleTimerStack.push(currentTimer);132 currentTimerStartTime = 0;133 currentTimerNestedFlushDuration = 0;134 currentTimerDebugID = null;135 currentTimerType = null;136 };137 var resumeCurrentLifeCycleTimer = function resumeCurrentLifeCycleTimer() {138 var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(),139 startTime = _lifeCycleTimerStack$.startTime,140 nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime,141 debugID = _lifeCycleTimerStack$.debugID,142 timerType = _lifeCycleTimerStack$.timerType;143 var nestedFlushDuration = performanceNow() - nestedFlushStartTime;144 currentTimerStartTime = startTime;145 currentTimerNestedFlushDuration += nestedFlushDuration;146 currentTimerDebugID = debugID;147 currentTimerType = timerType;148 };149 var lastMarkTimeStamp = 0;150 var canUsePerformanceMeasure = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';151 var shouldMark = function shouldMark(debugID) {152 if (!_isProfiling || !canUsePerformanceMeasure) {153 return false;154 }155 var element = ReactComponentTreeHook.getElement(debugID);156 if (element == null || typeof element !== 'object') {157 return false;158 }159 var isHostElement = typeof element.type === 'string';160 if (isHostElement) {161 return false;162 }163 return true;164 };165 var markBegin = function markBegin(debugID, markType) {166 if (!shouldMark(debugID)) {167 return;168 }169 var markName = debugID + '::' + markType;170 lastMarkTimeStamp = performanceNow();171 performance.mark(markName);172 };173 var markEnd = function markEnd(debugID, markType) {174 if (!shouldMark(debugID)) {175 return;176 }177 var markName = debugID + '::' + markType;178 var displayName = ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown';179 var timeStamp = performanceNow();180 if (timeStamp - lastMarkTimeStamp > 0.1) {181 var measurementName = displayName + ' [' + markType + ']';182 performance.measure(measurementName, markName);183 }184 performance.clearMarks(markName);185 performance.clearMeasures(measurementName);186 };187 ReactDebugTool = {188 addHook: function addHook(hook) {189 hooks.push(hook);190 },191 removeHook: function removeHook(hook) {192 for (var i = 0; i < hooks.length; i++) {193 if (hooks[i] === hook) {194 hooks.splice(i, 1);195 i--;196 }197 }198 },199 isProfiling: function isProfiling() {200 return _isProfiling;201 },202 beginProfiling: function beginProfiling() {203 if (_isProfiling) {204 return;205 }206 _isProfiling = true;207 flushHistory.length = 0;208 resetMeasurements();209 ReactDebugTool.addHook(ReactHostOperationHistoryHook);210 },211 endProfiling: function endProfiling() {212 if (!_isProfiling) {213 return;214 }215 _isProfiling = false;216 resetMeasurements();217 ReactDebugTool.removeHook(ReactHostOperationHistoryHook);218 },219 getFlushHistory: function getFlushHistory() {220 return flushHistory;221 },222 onBeginFlush: function onBeginFlush() {223 currentFlushNesting++;224 resetMeasurements();225 pauseCurrentLifeCycleTimer();226 emitEvent('onBeginFlush');227 },228 onEndFlush: function onEndFlush() {229 resetMeasurements();230 currentFlushNesting--;231 resumeCurrentLifeCycleTimer();232 emitEvent('onEndFlush');233 },234 onBeginLifeCycleTimer: function onBeginLifeCycleTimer(debugID, timerType) {235 checkDebugID(debugID);236 emitEvent('onBeginLifeCycleTimer', debugID, timerType);237 markBegin(debugID, timerType);238 beginLifeCycleTimer(debugID, timerType);239 },240 onEndLifeCycleTimer: function onEndLifeCycleTimer(debugID, timerType) {241 checkDebugID(debugID);242 endLifeCycleTimer(debugID, timerType);243 markEnd(debugID, timerType);244 emitEvent('onEndLifeCycleTimer', debugID, timerType);245 },246 onBeginProcessingChildContext: function onBeginProcessingChildContext() {247 emitEvent('onBeginProcessingChildContext');248 },249 onEndProcessingChildContext: function onEndProcessingChildContext() {250 emitEvent('onEndProcessingChildContext');251 },252 onHostOperation: function onHostOperation(operation) {...

Full Screen

Full Screen

f1631fcf9e01e313efd6959ee3d84473311828ReactDebugTool.js

Source:f1631fcf9e01e313efd6959ee3d84473311828ReactDebugTool.js Github

copy

Full Screen

...87 if (!debugID) {88 warning(false, 'ReactDebugTool: debugID may not be empty.');89 }90 };91 var beginLifeCycleTimer = function beginLifeCycleTimer(debugID, timerType) {92 if (currentFlushNesting === 0) {93 return;94 }95 if (currentTimerType && !lifeCycleTimerHasWarned) {96 warning(false, 'There is an internal error in the React performance measurement code.' + '\n\nDid not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another');97 lifeCycleTimerHasWarned = true;98 }99 currentTimerStartTime = performanceNow();100 currentTimerNestedFlushDuration = 0;101 currentTimerDebugID = debugID;102 currentTimerType = timerType;103 };104 var endLifeCycleTimer = function endLifeCycleTimer(debugID, timerType) {105 if (currentFlushNesting === 0) {106 return;107 }108 if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) {109 warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another');110 lifeCycleTimerHasWarned = true;111 }112 if (_isProfiling) {113 currentFlushMeasurements.push({114 timerType: timerType,115 instanceID: debugID,116 duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration117 });118 }119 currentTimerStartTime = 0;120 currentTimerNestedFlushDuration = 0;121 currentTimerDebugID = null;122 currentTimerType = null;123 };124 var pauseCurrentLifeCycleTimer = function pauseCurrentLifeCycleTimer() {125 var currentTimer = {126 startTime: currentTimerStartTime,127 nestedFlushStartTime: performanceNow(),128 debugID: currentTimerDebugID,129 timerType: currentTimerType130 };131 lifeCycleTimerStack.push(currentTimer);132 currentTimerStartTime = 0;133 currentTimerNestedFlushDuration = 0;134 currentTimerDebugID = null;135 currentTimerType = null;136 };137 var resumeCurrentLifeCycleTimer = function resumeCurrentLifeCycleTimer() {138 var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(),139 startTime = _lifeCycleTimerStack$.startTime,140 nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime,141 debugID = _lifeCycleTimerStack$.debugID,142 timerType = _lifeCycleTimerStack$.timerType;143 var nestedFlushDuration = performanceNow() - nestedFlushStartTime;144 currentTimerStartTime = startTime;145 currentTimerNestedFlushDuration += nestedFlushDuration;146 currentTimerDebugID = debugID;147 currentTimerType = timerType;148 };149 var lastMarkTimeStamp = 0;150 var canUsePerformanceMeasure = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';151 var shouldMark = function shouldMark(debugID) {152 if (!_isProfiling || !canUsePerformanceMeasure) {153 return false;154 }155 var element = ReactComponentTreeHook.getElement(debugID);156 if (element == null || typeof element !== 'object') {157 return false;158 }159 var isHostElement = typeof element.type === 'string';160 if (isHostElement) {161 return false;162 }163 return true;164 };165 var markBegin = function markBegin(debugID, markType) {166 if (!shouldMark(debugID)) {167 return;168 }169 var markName = debugID + '::' + markType;170 lastMarkTimeStamp = performanceNow();171 performance.mark(markName);172 };173 var markEnd = function markEnd(debugID, markType) {174 if (!shouldMark(debugID)) {175 return;176 }177 var markName = debugID + '::' + markType;178 var displayName = ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown';179 var timeStamp = performanceNow();180 if (timeStamp - lastMarkTimeStamp > 0.1) {181 var measurementName = displayName + ' [' + markType + ']';182 performance.measure(measurementName, markName);183 }184 performance.clearMarks(markName);185 performance.clearMeasures(measurementName);186 };187 ReactDebugTool = {188 addHook: function addHook(hook) {189 hooks.push(hook);190 },191 removeHook: function removeHook(hook) {192 for (var i = 0; i < hooks.length; i++) {193 if (hooks[i] === hook) {194 hooks.splice(i, 1);195 i--;196 }197 }198 },199 isProfiling: function isProfiling() {200 return _isProfiling;201 },202 beginProfiling: function beginProfiling() {203 if (_isProfiling) {204 return;205 }206 _isProfiling = true;207 flushHistory.length = 0;208 resetMeasurements();209 ReactDebugTool.addHook(ReactHostOperationHistoryHook);210 },211 endProfiling: function endProfiling() {212 if (!_isProfiling) {213 return;214 }215 _isProfiling = false;216 resetMeasurements();217 ReactDebugTool.removeHook(ReactHostOperationHistoryHook);218 },219 getFlushHistory: function getFlushHistory() {220 return flushHistory;221 },222 onBeginFlush: function onBeginFlush() {223 currentFlushNesting++;224 resetMeasurements();225 pauseCurrentLifeCycleTimer();226 emitEvent('onBeginFlush');227 },228 onEndFlush: function onEndFlush() {229 resetMeasurements();230 currentFlushNesting--;231 resumeCurrentLifeCycleTimer();232 emitEvent('onEndFlush');233 },234 onBeginLifeCycleTimer: function onBeginLifeCycleTimer(debugID, timerType) {235 checkDebugID(debugID);236 emitEvent('onBeginLifeCycleTimer', debugID, timerType);237 markBegin(debugID, timerType);238 beginLifeCycleTimer(debugID, timerType);239 },240 onEndLifeCycleTimer: function onEndLifeCycleTimer(debugID, timerType) {241 checkDebugID(debugID);242 endLifeCycleTimer(debugID, timerType);243 markEnd(debugID, timerType);244 emitEvent('onEndLifeCycleTimer', debugID, timerType);245 },246 onBeginProcessingChildContext: function onBeginProcessingChildContext() {247 emitEvent('onBeginProcessingChildContext');248 },249 onEndProcessingChildContext: function onEndProcessingChildContext() {250 emitEvent('onEndProcessingChildContext');251 },252 onHostOperation: function onHostOperation(operation) {...

Full Screen

Full Screen

106d42002a99b24f42892d550eb26157212a2cReactDebugTool.js

Source:106d42002a99b24f42892d550eb26157212a2cReactDebugTool.js Github

copy

Full Screen

...87 if (!debugID) {88 warning(false, 'ReactDebugTool: debugID may not be empty.');89 }90 };91 var beginLifeCycleTimer = function beginLifeCycleTimer(debugID, timerType) {92 if (currentFlushNesting === 0) {93 return;94 }95 if (currentTimerType && !lifeCycleTimerHasWarned) {96 warning(false, 'There is an internal error in the React performance measurement code.' + '\n\nDid not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another');97 lifeCycleTimerHasWarned = true;98 }99 currentTimerStartTime = performanceNow();100 currentTimerNestedFlushDuration = 0;101 currentTimerDebugID = debugID;102 currentTimerType = timerType;103 };104 var endLifeCycleTimer = function endLifeCycleTimer(debugID, timerType) {105 if (currentFlushNesting === 0) {106 return;107 }108 if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) {109 warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another');110 lifeCycleTimerHasWarned = true;111 }112 if (_isProfiling) {113 currentFlushMeasurements.push({114 timerType: timerType,115 instanceID: debugID,116 duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration117 });118 }119 currentTimerStartTime = 0;120 currentTimerNestedFlushDuration = 0;121 currentTimerDebugID = null;122 currentTimerType = null;123 };124 var pauseCurrentLifeCycleTimer = function pauseCurrentLifeCycleTimer() {125 var currentTimer = {126 startTime: currentTimerStartTime,127 nestedFlushStartTime: performanceNow(),128 debugID: currentTimerDebugID,129 timerType: currentTimerType130 };131 lifeCycleTimerStack.push(currentTimer);132 currentTimerStartTime = 0;133 currentTimerNestedFlushDuration = 0;134 currentTimerDebugID = null;135 currentTimerType = null;136 };137 var resumeCurrentLifeCycleTimer = function resumeCurrentLifeCycleTimer() {138 var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(),139 startTime = _lifeCycleTimerStack$.startTime,140 nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime,141 debugID = _lifeCycleTimerStack$.debugID,142 timerType = _lifeCycleTimerStack$.timerType;143 var nestedFlushDuration = performanceNow() - nestedFlushStartTime;144 currentTimerStartTime = startTime;145 currentTimerNestedFlushDuration += nestedFlushDuration;146 currentTimerDebugID = debugID;147 currentTimerType = timerType;148 };149 var lastMarkTimeStamp = 0;150 var canUsePerformanceMeasure = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';151 var shouldMark = function shouldMark(debugID) {152 if (!_isProfiling || !canUsePerformanceMeasure) {153 return false;154 }155 var element = ReactComponentTreeHook.getElement(debugID);156 if (element == null || typeof element !== 'object') {157 return false;158 }159 var isHostElement = typeof element.type === 'string';160 if (isHostElement) {161 return false;162 }163 return true;164 };165 var markBegin = function markBegin(debugID, markType) {166 if (!shouldMark(debugID)) {167 return;168 }169 var markName = debugID + '::' + markType;170 lastMarkTimeStamp = performanceNow();171 performance.mark(markName);172 };173 var markEnd = function markEnd(debugID, markType) {174 if (!shouldMark(debugID)) {175 return;176 }177 var markName = debugID + '::' + markType;178 var displayName = ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown';179 var timeStamp = performanceNow();180 if (timeStamp - lastMarkTimeStamp > 0.1) {181 var measurementName = displayName + ' [' + markType + ']';182 performance.measure(measurementName, markName);183 }184 performance.clearMarks(markName);185 performance.clearMeasures(measurementName);186 };187 ReactDebugTool = {188 addHook: function addHook(hook) {189 hooks.push(hook);190 },191 removeHook: function removeHook(hook) {192 for (var i = 0; i < hooks.length; i++) {193 if (hooks[i] === hook) {194 hooks.splice(i, 1);195 i--;196 }197 }198 },199 isProfiling: function isProfiling() {200 return _isProfiling;201 },202 beginProfiling: function beginProfiling() {203 if (_isProfiling) {204 return;205 }206 _isProfiling = true;207 flushHistory.length = 0;208 resetMeasurements();209 ReactDebugTool.addHook(ReactHostOperationHistoryHook);210 },211 endProfiling: function endProfiling() {212 if (!_isProfiling) {213 return;214 }215 _isProfiling = false;216 resetMeasurements();217 ReactDebugTool.removeHook(ReactHostOperationHistoryHook);218 },219 getFlushHistory: function getFlushHistory() {220 return flushHistory;221 },222 onBeginFlush: function onBeginFlush() {223 currentFlushNesting++;224 resetMeasurements();225 pauseCurrentLifeCycleTimer();226 emitEvent('onBeginFlush');227 },228 onEndFlush: function onEndFlush() {229 resetMeasurements();230 currentFlushNesting--;231 resumeCurrentLifeCycleTimer();232 emitEvent('onEndFlush');233 },234 onBeginLifeCycleTimer: function onBeginLifeCycleTimer(debugID, timerType) {235 checkDebugID(debugID);236 emitEvent('onBeginLifeCycleTimer', debugID, timerType);237 markBegin(debugID, timerType);238 beginLifeCycleTimer(debugID, timerType);239 },240 onEndLifeCycleTimer: function onEndLifeCycleTimer(debugID, timerType) {241 checkDebugID(debugID);242 endLifeCycleTimer(debugID, timerType);243 markEnd(debugID, timerType);244 emitEvent('onEndLifeCycleTimer', debugID, timerType);245 },246 onBeginProcessingChildContext: function onBeginProcessingChildContext() {247 emitEvent('onBeginProcessingChildContext');248 },249 onEndProcessingChildContext: function onEndProcessingChildContext() {250 emitEvent('onEndProcessingChildContext');251 },252 onHostOperation: function onHostOperation(operation) {...

Full Screen

Full Screen

701e31c3e90adbd4a9d1884b10bcfe55b4ff72ReactDebugTool.js

Source:701e31c3e90adbd4a9d1884b10bcfe55b4ff72ReactDebugTool.js Github

copy

Full Screen

...87 if (!debugID) {88 warning(false, 'ReactDebugTool: debugID may not be empty.');89 }90 };91 var beginLifeCycleTimer = function beginLifeCycleTimer(debugID, timerType) {92 if (currentFlushNesting === 0) {93 return;94 }95 if (currentTimerType && !lifeCycleTimerHasWarned) {96 warning(false, 'There is an internal error in the React performance measurement code.' + '\n\nDid not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another');97 lifeCycleTimerHasWarned = true;98 }99 currentTimerStartTime = performanceNow();100 currentTimerNestedFlushDuration = 0;101 currentTimerDebugID = debugID;102 currentTimerType = timerType;103 };104 var endLifeCycleTimer = function endLifeCycleTimer(debugID, timerType) {105 if (currentFlushNesting === 0) {106 return;107 }108 if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) {109 warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another');110 lifeCycleTimerHasWarned = true;111 }112 if (_isProfiling) {113 currentFlushMeasurements.push({114 timerType: timerType,115 instanceID: debugID,116 duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration117 });118 }119 currentTimerStartTime = 0;120 currentTimerNestedFlushDuration = 0;121 currentTimerDebugID = null;122 currentTimerType = null;123 };124 var pauseCurrentLifeCycleTimer = function pauseCurrentLifeCycleTimer() {125 var currentTimer = {126 startTime: currentTimerStartTime,127 nestedFlushStartTime: performanceNow(),128 debugID: currentTimerDebugID,129 timerType: currentTimerType130 };131 lifeCycleTimerStack.push(currentTimer);132 currentTimerStartTime = 0;133 currentTimerNestedFlushDuration = 0;134 currentTimerDebugID = null;135 currentTimerType = null;136 };137 var resumeCurrentLifeCycleTimer = function resumeCurrentLifeCycleTimer() {138 var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(),139 startTime = _lifeCycleTimerStack$.startTime,140 nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime,141 debugID = _lifeCycleTimerStack$.debugID,142 timerType = _lifeCycleTimerStack$.timerType;143 var nestedFlushDuration = performanceNow() - nestedFlushStartTime;144 currentTimerStartTime = startTime;145 currentTimerNestedFlushDuration += nestedFlushDuration;146 currentTimerDebugID = debugID;147 currentTimerType = timerType;148 };149 var lastMarkTimeStamp = 0;150 var canUsePerformanceMeasure = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';151 var shouldMark = function shouldMark(debugID) {152 if (!_isProfiling || !canUsePerformanceMeasure) {153 return false;154 }155 var element = ReactComponentTreeHook.getElement(debugID);156 if (element == null || typeof element !== 'object') {157 return false;158 }159 var isHostElement = typeof element.type === 'string';160 if (isHostElement) {161 return false;162 }163 return true;164 };165 var markBegin = function markBegin(debugID, markType) {166 if (!shouldMark(debugID)) {167 return;168 }169 var markName = debugID + '::' + markType;170 lastMarkTimeStamp = performanceNow();171 performance.mark(markName);172 };173 var markEnd = function markEnd(debugID, markType) {174 if (!shouldMark(debugID)) {175 return;176 }177 var markName = debugID + '::' + markType;178 var displayName = ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown';179 var timeStamp = performanceNow();180 if (timeStamp - lastMarkTimeStamp > 0.1) {181 var measurementName = displayName + ' [' + markType + ']';182 performance.measure(measurementName, markName);183 }184 performance.clearMarks(markName);185 performance.clearMeasures(measurementName);186 };187 ReactDebugTool = {188 addHook: function addHook(hook) {189 hooks.push(hook);190 },191 removeHook: function removeHook(hook) {192 for (var i = 0; i < hooks.length; i++) {193 if (hooks[i] === hook) {194 hooks.splice(i, 1);195 i--;196 }197 }198 },199 isProfiling: function isProfiling() {200 return _isProfiling;201 },202 beginProfiling: function beginProfiling() {203 if (_isProfiling) {204 return;205 }206 _isProfiling = true;207 flushHistory.length = 0;208 resetMeasurements();209 ReactDebugTool.addHook(ReactHostOperationHistoryHook);210 },211 endProfiling: function endProfiling() {212 if (!_isProfiling) {213 return;214 }215 _isProfiling = false;216 resetMeasurements();217 ReactDebugTool.removeHook(ReactHostOperationHistoryHook);218 },219 getFlushHistory: function getFlushHistory() {220 return flushHistory;221 },222 onBeginFlush: function onBeginFlush() {223 currentFlushNesting++;224 resetMeasurements();225 pauseCurrentLifeCycleTimer();226 emitEvent('onBeginFlush');227 },228 onEndFlush: function onEndFlush() {229 resetMeasurements();230 currentFlushNesting--;231 resumeCurrentLifeCycleTimer();232 emitEvent('onEndFlush');233 },234 onBeginLifeCycleTimer: function onBeginLifeCycleTimer(debugID, timerType) {235 checkDebugID(debugID);236 emitEvent('onBeginLifeCycleTimer', debugID, timerType);237 markBegin(debugID, timerType);238 beginLifeCycleTimer(debugID, timerType);239 },240 onEndLifeCycleTimer: function onEndLifeCycleTimer(debugID, timerType) {241 checkDebugID(debugID);242 endLifeCycleTimer(debugID, timerType);243 markEnd(debugID, timerType);244 emitEvent('onEndLifeCycleTimer', debugID, timerType);245 },246 onBeginProcessingChildContext: function onBeginProcessingChildContext() {247 emitEvent('onBeginProcessingChildContext');248 },249 onEndProcessingChildContext: function onEndProcessingChildContext() {250 emitEvent('onEndProcessingChildContext');251 },252 onHostOperation: function onHostOperation(operation) {...

Full Screen

Full Screen

1b7731bcb216f3ddb5d71e317c587cfa499da9ReactDebugTool.js

Source:1b7731bcb216f3ddb5d71e317c587cfa499da9ReactDebugTool.js Github

copy

Full Screen

...87 if (!debugID) {88 warning(false, 'ReactDebugTool: debugID may not be empty.');89 }90 };91 var beginLifeCycleTimer = function beginLifeCycleTimer(debugID, timerType) {92 if (currentFlushNesting === 0) {93 return;94 }95 if (currentTimerType && !lifeCycleTimerHasWarned) {96 warning(false, 'There is an internal error in the React performance measurement code.' + '\n\nDid not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another');97 lifeCycleTimerHasWarned = true;98 }99 currentTimerStartTime = performanceNow();100 currentTimerNestedFlushDuration = 0;101 currentTimerDebugID = debugID;102 currentTimerType = timerType;103 };104 var endLifeCycleTimer = function endLifeCycleTimer(debugID, timerType) {105 if (currentFlushNesting === 0) {106 return;107 }108 if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) {109 warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another');110 lifeCycleTimerHasWarned = true;111 }112 if (_isProfiling) {113 currentFlushMeasurements.push({114 timerType: timerType,115 instanceID: debugID,116 duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration117 });118 }119 currentTimerStartTime = 0;120 currentTimerNestedFlushDuration = 0;121 currentTimerDebugID = null;122 currentTimerType = null;123 };124 var pauseCurrentLifeCycleTimer = function pauseCurrentLifeCycleTimer() {125 var currentTimer = {126 startTime: currentTimerStartTime,127 nestedFlushStartTime: performanceNow(),128 debugID: currentTimerDebugID,129 timerType: currentTimerType130 };131 lifeCycleTimerStack.push(currentTimer);132 currentTimerStartTime = 0;133 currentTimerNestedFlushDuration = 0;134 currentTimerDebugID = null;135 currentTimerType = null;136 };137 var resumeCurrentLifeCycleTimer = function resumeCurrentLifeCycleTimer() {138 var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(),139 startTime = _lifeCycleTimerStack$.startTime,140 nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime,141 debugID = _lifeCycleTimerStack$.debugID,142 timerType = _lifeCycleTimerStack$.timerType;143 var nestedFlushDuration = performanceNow() - nestedFlushStartTime;144 currentTimerStartTime = startTime;145 currentTimerNestedFlushDuration += nestedFlushDuration;146 currentTimerDebugID = debugID;147 currentTimerType = timerType;148 };149 var lastMarkTimeStamp = 0;150 var canUsePerformanceMeasure = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';151 var shouldMark = function shouldMark(debugID) {152 if (!_isProfiling || !canUsePerformanceMeasure) {153 return false;154 }155 var element = ReactComponentTreeHook.getElement(debugID);156 if (element == null || typeof element !== 'object') {157 return false;158 }159 var isHostElement = typeof element.type === 'string';160 if (isHostElement) {161 return false;162 }163 return true;164 };165 var markBegin = function markBegin(debugID, markType) {166 if (!shouldMark(debugID)) {167 return;168 }169 var markName = debugID + '::' + markType;170 lastMarkTimeStamp = performanceNow();171 performance.mark(markName);172 };173 var markEnd = function markEnd(debugID, markType) {174 if (!shouldMark(debugID)) {175 return;176 }177 var markName = debugID + '::' + markType;178 var displayName = ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown';179 var timeStamp = performanceNow();180 if (timeStamp - lastMarkTimeStamp > 0.1) {181 var measurementName = displayName + ' [' + markType + ']';182 performance.measure(measurementName, markName);183 }184 performance.clearMarks(markName);185 performance.clearMeasures(measurementName);186 };187 ReactDebugTool = {188 addHook: function addHook(hook) {189 hooks.push(hook);190 },191 removeHook: function removeHook(hook) {192 for (var i = 0; i < hooks.length; i++) {193 if (hooks[i] === hook) {194 hooks.splice(i, 1);195 i--;196 }197 }198 },199 isProfiling: function isProfiling() {200 return _isProfiling;201 },202 beginProfiling: function beginProfiling() {203 if (_isProfiling) {204 return;205 }206 _isProfiling = true;207 flushHistory.length = 0;208 resetMeasurements();209 ReactDebugTool.addHook(ReactHostOperationHistoryHook);210 },211 endProfiling: function endProfiling() {212 if (!_isProfiling) {213 return;214 }215 _isProfiling = false;216 resetMeasurements();217 ReactDebugTool.removeHook(ReactHostOperationHistoryHook);218 },219 getFlushHistory: function getFlushHistory() {220 return flushHistory;221 },222 onBeginFlush: function onBeginFlush() {223 currentFlushNesting++;224 resetMeasurements();225 pauseCurrentLifeCycleTimer();226 emitEvent('onBeginFlush');227 },228 onEndFlush: function onEndFlush() {229 resetMeasurements();230 currentFlushNesting--;231 resumeCurrentLifeCycleTimer();232 emitEvent('onEndFlush');233 },234 onBeginLifeCycleTimer: function onBeginLifeCycleTimer(debugID, timerType) {235 checkDebugID(debugID);236 emitEvent('onBeginLifeCycleTimer', debugID, timerType);237 markBegin(debugID, timerType);238 beginLifeCycleTimer(debugID, timerType);239 },240 onEndLifeCycleTimer: function onEndLifeCycleTimer(debugID, timerType) {241 checkDebugID(debugID);242 endLifeCycleTimer(debugID, timerType);243 markEnd(debugID, timerType);244 emitEvent('onEndLifeCycleTimer', debugID, timerType);245 },246 onBeginProcessingChildContext: function onBeginProcessingChildContext() {247 emitEvent('onBeginProcessingChildContext');248 },249 onEndProcessingChildContext: function onEndProcessingChildContext() {250 emitEvent('onEndProcessingChildContext');251 },252 onHostOperation: function onHostOperation(operation) {...

Full Screen

Full Screen

518d579a5f1532e0036361c4adc179618f6669ReactDebugTool.js

Source:518d579a5f1532e0036361c4adc179618f6669ReactDebugTool.js Github

copy

Full Screen

...87 if (!debugID) {88 warning(false, 'ReactDebugTool: debugID may not be empty.');89 }90 };91 var beginLifeCycleTimer = function beginLifeCycleTimer(debugID, timerType) {92 if (currentFlushNesting === 0) {93 return;94 }95 if (currentTimerType && !lifeCycleTimerHasWarned) {96 warning(false, 'There is an internal error in the React performance measurement code.' + '\n\nDid not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another');97 lifeCycleTimerHasWarned = true;98 }99 currentTimerStartTime = performanceNow();100 currentTimerNestedFlushDuration = 0;101 currentTimerDebugID = debugID;102 currentTimerType = timerType;103 };104 var endLifeCycleTimer = function endLifeCycleTimer(debugID, timerType) {105 if (currentFlushNesting === 0) {106 return;107 }108 if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) {109 warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another');110 lifeCycleTimerHasWarned = true;111 }112 if (_isProfiling) {113 currentFlushMeasurements.push({114 timerType: timerType,115 instanceID: debugID,116 duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration117 });118 }119 currentTimerStartTime = 0;120 currentTimerNestedFlushDuration = 0;121 currentTimerDebugID = null;122 currentTimerType = null;123 };124 var pauseCurrentLifeCycleTimer = function pauseCurrentLifeCycleTimer() {125 var currentTimer = {126 startTime: currentTimerStartTime,127 nestedFlushStartTime: performanceNow(),128 debugID: currentTimerDebugID,129 timerType: currentTimerType130 };131 lifeCycleTimerStack.push(currentTimer);132 currentTimerStartTime = 0;133 currentTimerNestedFlushDuration = 0;134 currentTimerDebugID = null;135 currentTimerType = null;136 };137 var resumeCurrentLifeCycleTimer = function resumeCurrentLifeCycleTimer() {138 var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(),139 startTime = _lifeCycleTimerStack$.startTime,140 nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime,141 debugID = _lifeCycleTimerStack$.debugID,142 timerType = _lifeCycleTimerStack$.timerType;143 var nestedFlushDuration = performanceNow() - nestedFlushStartTime;144 currentTimerStartTime = startTime;145 currentTimerNestedFlushDuration += nestedFlushDuration;146 currentTimerDebugID = debugID;147 currentTimerType = timerType;148 };149 var lastMarkTimeStamp = 0;150 var canUsePerformanceMeasure = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';151 var shouldMark = function shouldMark(debugID) {152 if (!_isProfiling || !canUsePerformanceMeasure) {153 return false;154 }155 var element = ReactComponentTreeHook.getElement(debugID);156 if (element == null || typeof element !== 'object') {157 return false;158 }159 var isHostElement = typeof element.type === 'string';160 if (isHostElement) {161 return false;162 }163 return true;164 };165 var markBegin = function markBegin(debugID, markType) {166 if (!shouldMark(debugID)) {167 return;168 }169 var markName = debugID + '::' + markType;170 lastMarkTimeStamp = performanceNow();171 performance.mark(markName);172 };173 var markEnd = function markEnd(debugID, markType) {174 if (!shouldMark(debugID)) {175 return;176 }177 var markName = debugID + '::' + markType;178 var displayName = ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown';179 var timeStamp = performanceNow();180 if (timeStamp - lastMarkTimeStamp > 0.1) {181 var measurementName = displayName + ' [' + markType + ']';182 performance.measure(measurementName, markName);183 }184 performance.clearMarks(markName);185 performance.clearMeasures(measurementName);186 };187 ReactDebugTool = {188 addHook: function addHook(hook) {189 hooks.push(hook);190 },191 removeHook: function removeHook(hook) {192 for (var i = 0; i < hooks.length; i++) {193 if (hooks[i] === hook) {194 hooks.splice(i, 1);195 i--;196 }197 }198 },199 isProfiling: function isProfiling() {200 return _isProfiling;201 },202 beginProfiling: function beginProfiling() {203 if (_isProfiling) {204 return;205 }206 _isProfiling = true;207 flushHistory.length = 0;208 resetMeasurements();209 ReactDebugTool.addHook(ReactHostOperationHistoryHook);210 },211 endProfiling: function endProfiling() {212 if (!_isProfiling) {213 return;214 }215 _isProfiling = false;216 resetMeasurements();217 ReactDebugTool.removeHook(ReactHostOperationHistoryHook);218 },219 getFlushHistory: function getFlushHistory() {220 return flushHistory;221 },222 onBeginFlush: function onBeginFlush() {223 currentFlushNesting++;224 resetMeasurements();225 pauseCurrentLifeCycleTimer();226 emitEvent('onBeginFlush');227 },228 onEndFlush: function onEndFlush() {229 resetMeasurements();230 currentFlushNesting--;231 resumeCurrentLifeCycleTimer();232 emitEvent('onEndFlush');233 },234 onBeginLifeCycleTimer: function onBeginLifeCycleTimer(debugID, timerType) {235 checkDebugID(debugID);236 emitEvent('onBeginLifeCycleTimer', debugID, timerType);237 markBegin(debugID, timerType);238 beginLifeCycleTimer(debugID, timerType);239 },240 onEndLifeCycleTimer: function onEndLifeCycleTimer(debugID, timerType) {241 checkDebugID(debugID);242 endLifeCycleTimer(debugID, timerType);243 markEnd(debugID, timerType);244 emitEvent('onEndLifeCycleTimer', debugID, timerType);245 },246 onBeginProcessingChildContext: function onBeginProcessingChildContext() {247 emitEvent('onBeginProcessingChildContext');248 },249 onEndProcessingChildContext: function onEndProcessingChildContext() {250 emitEvent('onEndProcessingChildContext');251 },252 onHostOperation: function onHostOperation(operation) {...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const playwright = require('playwright');2(async () => {3 const browser = await playwright.webkit.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.screenshot({ path: 'example.png' });7 await browser.close();8})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2const { beginLifeCycleTimer } = require('playwright/lib/server/supplements/recorder/recorderSupplement');3(async () => {4 const browser = await chromium.launch({headless: false});5 const context = await browser.newContext();6 const page = await context.newPage();7 const timer = beginLifeCycleTimer(page);8 await page.screenshot({ path: `screenshot.png` });9 await browser.close();10})();11const { chromium } = require('playwright');12const { beginLifeCycleTimer } = require('playwright/lib/server/supplements/recorder/recorderSupplement');13describe('Recorder', () => {14 it('should work', async () => {15 const browser = await chromium.launch({headless: false});16 const context = await browser.newContext();17 const page = await context.newPage();18 const timer = beginLifeCycleTimer(page);19 await page.screenshot({ path: `screenshot.png` });20 await browser.close();21 });22});

Full Screen

Using AI Code Generation

copy

Full Screen

1const { beginLifeCycleTimer } = require('playwright-core/lib/server/trace/recorder');2const { endLifeCycleTimer } = require('playwright-core/lib/server/trace/recorder');3const { createLifeCycleTimer } = require('playwright-core/lib/server/trace/recorder');4const { getLifeCycleTimer } = require('playwright-core/lib/server/trace/recorder');5const { deleteLifeCycleTimer } = require('playwright-core/lib/server/trace/recorder');6const { getLifeCycleTimerData } = require('playwright-core/lib/server/trace/recorder');7const { getLifeCycleTimerData } = require('playwright-core/lib/server/trace/recorder');8const { getLifeCycleTimerData } = require('playwright-core/lib/server/trace/recorder');9const { getLifeCycleTimerData } = require('playwright-core/lib/server/trace/recorder');10const { getLifeCycleTimerData } = require('playwright-core/lib/server/trace/recorder');11const { getLifeCycleTimerData } = require('playwright-core/lib/server/trace/recorder');12const { getLifeCycleTimerData } = require('playwright-core/lib/server/trace/recorder');13const { getLifeCycleTimerData } = require('playwright-core/lib/server/trace/recorder');14const { getLifeCycleTimerData } = require('playwright-core/lib/server/trace/recorder');

Full Screen

Using AI Code Generation

copy

Full Screen

1const { beginLifeCycleTimer } = require('playwright/lib/server/trace/recorder');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 beginLifeCycleTimer(page, 'name-of-timer');8 await browser.close();9})();10{11 {12 "args": {13 "data": {14 {15 }16 }17 }18 },19 {20 "args": {21 "data": {22 }23 }24 },25 {26 "args": {27 "data": {28 }29 }30 },31 {32 "args": {33 "data": {34 }

Full Screen

Using AI Code Generation

copy

Full Screen

1const { beginLifeCycleTimer } = require('playwright-core/lib/server/supplements/recorder/recorderSupplement.js');2const { LifeCycleEvent } = require('playwright-core/lib/server/supplements/recorder/lifecycleWatcher.js');3const { Page } = require('playwright-core/lib/client/page.js');4const { beginLifeCycleTimer } = require('playwright-core/lib/server/supplements/recorder/recorderSupplement.js');5const { LifeCycleEvent } = require('playwright-core/lib/server/supplements/recorder/lifecycleWatcher.js');6const { Page } = require('playwright-core/lib/client/page.js');7const { beginLifeCycleTimer } = require('playwright-core/lib/server/supplements/recorder/recorderSupplement.js');8const { LifeCycleEvent } = require('playwright-core/lib/server/supplements/recorder/lifecycleWatcher.js');9const { Page } = require('playwright-core/lib/client/page.js');10const { beginLifeCycleTimer } = require('playwright-core/lib/server/supplements/recorder/recorderSupplement.js');11const { LifeCycleEvent } = require('playwright-core/lib/server/supplements/recorder/lifecycleWatcher.js');12const { Page } = require('playwright-core/lib/client/page.js');13const { beginLifeCycleTimer } = require('playwright-core/lib/server/supplements/recorder/recorderSupplement.js');14const { LifeCycleEvent } = require('playwright-core/lib/server/supplements/recorder/lifecycleWatcher.js');15const { Page } = require('playwright-core/lib/client/page.js');16const { beginLifeCycleTimer } = require('playwright-core/lib/server/supplements/recorder/recorderSupplement.js');17const { LifeCycleEvent } = require('playwright-core/lib/server/supplements/recorder/lifecycleWatcher.js');18const { Page } = require('playwright-core/lib/client/page.js');19const { beginLifeCycleTimer } = require('playwright-core/lib/server/sup

Full Screen

Using AI Code Generation

copy

Full Screen

1const playwright = require('playwright');2const { beginLifeCycleTimer } = require('playwright/lib/utils/traceEvents');3(async () => {4 const browser = await playwright.chromium.launch();5 const context = await browser.newContext();6 await beginLifeCycleTimer(context, 'test');7 await browser.close();8})();9 at processTicksAndRejections (internal/process/task_queues.js:97:5)

Full Screen

Using AI Code Generation

copy

Full Screen

1const { beginLifeCycleTimer } = require("playwright-core/lib/server/supplements/recorder/recorderSupplement");2const page = await browser.newPage();3await beginLifeCycleTimer(page);4const { stopLifeCycleTimer } = require("playwright-core/lib/server/supplements/recorder/recorderSupplement");5const page = await browser.newPage();6await stopLifeCycleTimer(page);7const { getLifeCycleEvents } = require("playwright-core/lib/server/supplements/recorder/recorderSupplement");8const page = await browser.newPage();9await getLifeCycleEvents(page);10const { getLifeCycleEvents } = require("playwright-core/lib/server/supplements/recorder/recorderSupplement");11const page = await browser.newPage();12await getLifeCycleEvents(page);13const { getLifeCycleEvents } = require("playwright-core/lib/server/supplements/recorder/recorderSupplement");14const page = await browser.newPage();15await getLifeCycleEvents(page);16const { getLifeCycleEvents } = require("playwright-core/lib/server/supplements/recorder/recorderSupplement");17const page = await browser.newPage();18await getLifeCycleEvents(page);19const { getLifeCycleEvents } = require("playwright-core/lib/server/supplements/recorder/recorderSupplement");20const page = await browser.newPage();21await getLifeCycleEvents(page);22const { getLifeCycleEvents } = require("playwright-core/lib/server/supplements/recorder/recorderSupplement");23const page = await browser.newPage();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { test, expect } = require('@playwright/test');2const { beginLifeCycleTimer } = require('@playwright/test/lib/server/trace/recorder');3test('measure time taken for method to execute', async ({ page }) => {4 const timer = beginLifeCycleTimer('measure time taken for method to execute');5 timer.end();6 expect(timer.duration).toBeLessThan(5000);7});8 ✓ measure time taken for method to execute (3s)9 1 passed (3s)10 ✓ measure time taken for method to execute (3s)11 1 passed (3s)12{13 "stats": {

Full Screen

Using AI Code Generation

copy

Full Screen

1const { beginLifeCycleTimer } = require('@playwright/test/lib/utils/lifecycleTimer');2const { chromium, webkit, firefox } = require('playwright');3const browser = await chromium.launch();4const context = await browser.newContext();5const page = await context.newPage();6const timer = beginLifeCycleTimer();7console.log(timer.duration());8await browser.close();

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful