import type { SDK } from "../lib/sdk"; import type { ApiVersion } from "@what3words/api"; declare global { interface Window { [callback: string]: ((sdk?: SDK) => void) | undefined; what3words: SDK; what3words_session_id: string; w3w?: { callback?: string; key?: string; host?: string; version?: `${ApiVersion}`; headers?: Record; }; } } /** * This is the initialization function that gets called when the SDK is first loaded. This is actually the entrypoint * to the SDK. This is always called when the script is loaded on first load, and only once on first load. * * 1. The SDK when loaded first pulls any of the parameters provided when it was loaded and sets the options for them * for API requests using the SDK. * 2. The SDK is also attached to the window DOM if it is available. (It currently does not rety in the case of failure * or if the DOM is not yet accessible.) * 3. The callback if provided and available is called at the end of the pre-load script. * * TODO: * - Add a retry for attaching SDK to window with some backoff * - Could add some monitoring here to inform us of SDK usage. (Added what3words_session_id to the window - more needed) * - Any other async pre-load behaviour should occur here. See https://stenciljs.com/docs/config#globalscript */ export default function (): Promise;