mirror of
https://git.unlock-music.dev/um/um-react.git
synced 2024-11-28 04:42:17 +00:00
16 lines
666 B
TypeScript
16 lines
666 B
TypeScript
import type { DecryptCommandPayload } from '~/decrypt-worker/types';
|
|
import { DECRYPTION_WORKER_ACTION_NAME, DecryptionResult } from '~/decrypt-worker/constants';
|
|
|
|
import { ConcurrentQueue } from './ConcurrentQueue';
|
|
import { WorkerClientBus } from './WorkerEventBus';
|
|
|
|
export class DecryptionQueue extends ConcurrentQueue<DecryptCommandPayload, DecryptionResult> {
|
|
constructor(private workerClientBus: WorkerClientBus<DECRYPTION_WORKER_ACTION_NAME>, maxQueue?: number) {
|
|
super(maxQueue);
|
|
}
|
|
|
|
async handler(item: DecryptCommandPayload): Promise<DecryptionResult> {
|
|
return this.workerClientBus.request(DECRYPTION_WORKER_ACTION_NAME.DECRYPT, item);
|
|
}
|
|
}
|