chore: use url format for request id

This commit is contained in:
鲁树人 2023-05-18 22:12:45 +01:00
parent 635796ad69
commit 3b6d27948d

View File

@ -47,7 +47,7 @@ export class WorkerClientBus<T = string> {
async request<R, P>(actionName: T, payload: P): Promise<R> { async request<R, P>(actionName: T, payload: P): Promise<R> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const id = nanoid(); const id = `request://${actionName}/${nanoid()}`;
this.idPromiseMap.set(id, [resolve, reject]); this.idPromiseMap.set(id, [resolve, reject]);
this.worker.postMessage({ this.worker.postMessage({
id, id,