UNPKG

vite-plugin-shopify-theme-islands

Version:
37 lines (36 loc) 1.35 kB
import type { IslandLoader } from "./contract.js"; import { type RetryPlatform } from "./retry-scheduler.js"; export interface IslandLifecycleStartInput { getRoot(): HTMLElement | null; islandMap: Map<string, IslandLoader>; onActivate(tagName: string, el: HTMLElement, loader: () => Promise<unknown>): void; onDiscover?(tagName: string, el: HTMLElement): void; onBeforeInitialWalk?: () => void; onInitialWalkComplete?: () => void; } export interface IslandLifecycle { excludeRoot(root: HTMLElement): void; includeRoot(root: HTMLElement): void; isObserved(el: Element): boolean; settleSuccess(tag: string): number; settleFailure(tag: string, retry: () => void): { willRetry: boolean; attempt: number; }; evict(tag: string): void; clear(tags?: Iterable<string>): void; isQueued(tag: string): boolean; readonly initialWalkComplete: boolean; watchCancellable(el: Element, cancel: () => void): () => void; walk(root: HTMLElement): void; start(input: IslandLifecycleStartInput): { disconnect: () => void; }; } export interface IslandLifecyclePlatform extends RetryPlatform { } export declare function createIslandLifecycleCoordinator(opts: { retries: number; retryDelay: number; platform?: IslandLifecyclePlatform; }): IslandLifecycle;