From 22e686d09827482bc12f2da710be948d75d83afb Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Thu, 12 Nov 2020 21:19:32 +0100 Subject: [PATCH] fix: more rollbacks --- packages/core/profiling/index.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/core/profiling/index.ts b/packages/core/profiling/index.ts index 91cb4c04e..8bd3c1def 100644 --- a/packages/core/profiling/index.ts +++ b/packages/core/profiling/index.ts @@ -1,3 +1,4 @@ +/* eslint-disable prefer-rest-params */ declare let __startCPUProfiler: any; declare let __stopCPUProfiler: any; @@ -98,10 +99,10 @@ export function isRunning(name: string): boolean { function countersProfileFunctionFactory(fn: F, name: string, type: MemberType = MemberType.Instance): F { profileNames.push(name); - return function (...args) { + return function () { start(name); try { - return fn(...args); + return fn.apply(this, arguments); } finally { stop(name); } @@ -110,19 +111,19 @@ function countersProfileFunctionFactory(fn: F, name: string, function timelineProfileFunctionFactory(fn: F, name: string, type: MemberType = MemberType.Instance): F { return type === MemberType.Instance - ? function (...args) { + ? function () { const start = time(); try { - return fn(...args); + return fn.apply(this, arguments); } finally { const end = time(); console.log(`Timeline: Modules: ${name} ${this} (${start}ms. - ${end}ms.)`); } } - : function (...args) { + : function () { const start = time(); try { - return fn(...args); + return fn.apply(this, arguments); } finally { const end = time(); console.log(`Timeline: Modules: ${name} (${start}ms. - ${end}ms.)`);