import type { TimerOptions } from 'node:timers'; export declare let platform: Platform; export declare function set_platform(_platform: Platform): void; export interface NewWebSocketOptions { protocols?: string | string[]; proxy?: string; /** 默认不启用 keep alive */ keep_alive_duration?: undefined | number; } interface Platform { /** 在 nodejs 环境中 */ nodejs: boolean; /** 在 browser 环境中 */ browser: boolean; get_buffer(length: number): Uint8Array; encode(str: string): Uint8Array; delay(milliseconds: number, options?: TimerOptions): Promise; strip_ansi(str: string): string; /** 根据环境 new 一个 undici 的 WebSocket 或者浏览器全局的 WebSocket */ new_websocket(url: string | URL, options?: NewWebSocketOptions): Promise | WebSocket; } export {};