chore: type updates
This commit is contained in:
parent
15bde81afe
commit
3f61f20ac0
@ -27,7 +27,7 @@ export abstract class ConcurrentQueue<T> {
|
||||
}
|
||||
|
||||
private async processQueue() {
|
||||
while (true) {
|
||||
while (this.items.length > 0) {
|
||||
const item = this.items.pop();
|
||||
if (item === undefined) {
|
||||
break;
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { nanoid } from 'nanoid';
|
||||
|
||||
export class WorkerClientBus {
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export class WorkerClientBus<T = string> {
|
||||
private idPromiseMap = new Map<string, [(data: any) => void, (error: Error) => void]>();
|
||||
|
||||
constructor(private worker: Worker) {
|
||||
@ -22,7 +24,7 @@ export class WorkerClientBus {
|
||||
});
|
||||
}
|
||||
|
||||
async request<R = any, P = any>(actionName: string, payload: P): Promise<R> {
|
||||
async request<R = any, P = any>(actionName: T, payload: P): Promise<R> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const id = nanoid();
|
||||
this.idPromiseMap.set(id, [resolve, reject]);
|
||||
|
Loading…
Reference in New Issue
Block a user