import ProtocolMapping from 'devtools-protocol/types/protocol-mapping'; /** Returnable IPC types */ type IPCType = string | number | boolean | void; type Millennium = { /** * Call a method on the backend * @deprecated Use `callable` instead. * Example usage: * ```typescript * // before * const result = await Millennium.callServerMethod('methodName', { arg1: 'value' }); * // after * const method = callable<[{ arg1: string }]>("methodName"); * * const result1 = await method({ arg1: 'value1' }); * const result2 = await method({ arg1: 'value2' }); * ``` */ callServerMethod: (methodName: string, kwargs?: object) => Promise; findElement: (privateDocument: Document, querySelector: string, timeOut?: number) => Promise>; exposeObj?: (obj: T) => any; AddWindowCreateHook?: (callback: (context: object) => void) => void; }; /** * Make reusable IPC call declarations * * frontend: * ```typescript * const method = callable<[{ arg1: string }]>("methodName"); // declare the method * method({ arg1: 'value' }); // call the method * ``` * * backend: * ```python * def methodName(arg1: str): * pass * ``` */ declare const callable: ] | [] = [], Return extends IPCType = IPCType>(route: string) => (...params: Params) => Promise; export declare const pluginSelf: any; declare const CDP_PROXY_BINDING = "__millennium_cdp_proxy__"; declare const CDP_EXTENSION_BINDING = "__millennium_extension_route__"; declare const CDP_EXT_RESP = "MILLENNIUM_CHROME_DEV_TOOLS_PROTOCOL_DO_NOT_USE_OR_OVERRIDE_ONMESSAGE"; declare global { interface Window { Millennium: Millennium; [CDP_EXT_RESP]: { __handleCDPResponse: (response: any) => void; }; [CDP_EXTENSION_BINDING]: (message: string) => void; [CDP_PROXY_BINDING]: (message: string) => void; __millennium_cdp_resolve__: (callbackId: number, result: any) => void; __millennium_cdp_reject__: (callbackId: number, error: string) => void; __millennium_cdp_event__: (data: any) => void; } } declare const BindPluginSettings: () => any; declare const pluginConfig: { get: (key: string) => Promise; set: (key: string, value: any) => Promise; delete: (key: string) => Promise; getAll: >() => Promise; }; declare const usePluginConfig: { (key: string): [T | undefined, (value: T) => Promise]; (): [Record, (key: string, value: any) => Promise]; }; declare const subscribePluginConfig: (cb: (key: string, value: any) => void) => () => void; export declare class MillenniumChromeDevToolsProtocol { protected readonly _pluginName: string; eventListeners: Map void>>; private readonly _eventDispatcher; constructor(pluginName: string); on(event: T, listener: (params: ProtocolMapping.Events[T][0]) => void): () => void; off(event: T, listener: (params: ProtocolMapping.Events[T][0]) => void): void; send(method: T, params?: ProtocolMapping.Commands[T]['paramsType'][0], sessionId?: string): Promise; protected _sendViaExtensionRoute(method: T, params: ProtocolMapping.Commands[T]['paramsType'][0], sessionId?: string): Promise; } declare const ChromeDevToolsProtocol: MillenniumChromeDevToolsProtocol; declare const Millennium: Millennium; export { BindPluginSettings, callable, ChromeDevToolsProtocol, Millennium, pluginConfig, subscribePluginConfig, usePluginConfig };