add back code that got lost

This commit is contained in:
V 2023-11-23 06:45:01 +01:00
parent f39f16d34b
commit 81fb7c6322
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905

View file

@ -338,6 +338,9 @@ export function waitFor(filter: string | string[] | FilterFn, callback: Callback
else if (typeof filter !== "function")
throw new Error("filter must be a string, string[] or function, got " + typeof filter);
const [existing, id] = find(filter!, { isIndirect: true, isWaitFor: true });
if (existing) return void callback(existing, id);
subscriptions.set(filter, callback);
}