mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:20:43 +00:00
23 lines
689 B
TypeScript
23 lines
689 B
TypeScript
type FetchPreconnectOptions = {
|
|
dns?: boolean;
|
|
tcp?: boolean;
|
|
http?: boolean;
|
|
https?: boolean;
|
|
};
|
|
|
|
type FetchWithPreconnect = {
|
|
preconnect: (url: string | URL, options?: FetchPreconnectOptions) => void;
|
|
__openclawAcceptsDispatcher: true;
|
|
};
|
|
|
|
export function withBrowserFetchPreconnect<T extends typeof fetch>(fn: T): T & FetchWithPreconnect;
|
|
export function withBrowserFetchPreconnect<T extends object>(
|
|
fn: T,
|
|
): T & FetchWithPreconnect & typeof fetch;
|
|
export function withBrowserFetchPreconnect(fn: object) {
|
|
return Object.assign(fn, {
|
|
preconnect: (_url: string | URL, _options?: FetchPreconnectOptions) => {},
|
|
__openclawAcceptsDispatcher: true as const,
|
|
});
|
|
}
|