Skip to content

Commit

Permalink
use .call for deoptimization (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aslemammad authored Oct 11, 2023
1 parent f52f027 commit f8d0ada
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ export default class Task extends EventTarget {
let taskTime = 0;
if (isAsync) {
const taskStart = this.bench.now();
await this.fn();
await this.fn.call(this);
taskTime = this.bench.now() - taskStart;
} else {
const taskStart = this.bench.now();
this.fn();
this.fn.call(this);
taskTime = this.bench.now() - taskStart;
}

Expand Down Expand Up @@ -213,9 +213,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
Expand Down

0 comments on commit f8d0ada

Please sign in to comment.