refactor: dedupe agent and browser cli helpers
This commit is contained in:
@@ -2,12 +2,7 @@ import { describe, expect, it, vi } from "vitest";
|
||||
import { enqueueKeyedTask, KeyedAsyncQueue } from "./keyed-async-queue.js";
|
||||
|
||||
function deferred<T>() {
|
||||
let resolve!: (value: T | PromiseLike<T>) => void;
|
||||
let reject!: (reason?: unknown) => void;
|
||||
const promise = new Promise<T>((res, rej) => {
|
||||
resolve = res;
|
||||
reject = rej;
|
||||
});
|
||||
const { promise, resolve, reject } = Promise.withResolvers<T>();
|
||||
return { promise, resolve, reject };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user