From f0207992c35f36c1d2e16a03bff165b382400349 Mon Sep 17 00:00:00 2001 From: Mohammad Bagher Abiat Date: Sun, 23 Jul 2023 07:33:34 +0330 Subject: [PATCH] use .call for deoptimization --- src/task.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/task.ts b/src/task.ts index 72ede69..05f15c9 100644 --- a/src/task.ts +++ b/src/task.ts @@ -76,9 +76,9 @@ export default class Task extends EventTarget { const taskStart = this.bench.now(); if (isAsync) { - await this.fn(); + await this.fn.call(this); } else { - this.fn(); + this.fn.call(this); } const taskTime = this.bench.now() - taskStart; @@ -193,9 +193,9 @@ export default class Task extends EventTarget { try { // eslint-disable-next-line no-await-in-loop if (isAsync) { - await this.fn(); + await this.fn.call(this); } else { - this.fn(); + this.fn.call(this); } } catch { // todo