public enqueueTask (task: Task<Data>): number {
const tasksQueueSize = this.tasksQueue.push(task)
if (this.onBackPressure != null && this.hasBackPressure()) {
- once(this.onBackPressure)(this.info.id as number)
+ once(this.onBackPressure, this)(this.info.id as number)
}
return tasksQueueSize
}
public unshiftTask (task: Task<Data>): number {
const tasksQueueSize = this.tasksQueue.unshift(task)
if (this.onBackPressure != null && this.hasBackPressure()) {
- once(this.onBackPressure)(this.info.id as number)
+ once(this.onBackPressure, this)(this.info.id as number)
}
return tasksQueueSize
}
export const once = (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
fn: (...args: any[]) => void,
- context = this
+ context: unknown
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): ((...args: any[]) => void) => {
let called = false