vite-plugin-shopify-theme-islands
Version:
Vite plugin for island architecture in Shopify themes
28 lines (27 loc) • 949 B
TypeScript
import type { IslandLoader } from "./contract.js";
export interface IslandLifecycleStartInput {
getRoot(): HTMLElement | null;
islandMap: Map<string, IslandLoader>;
onActivate(tagName: string, el: HTMLElement, loader: () => Promise<unknown>): void;
onBeforeInitialWalk?: () => void;
onInitialWalkComplete?: () => void;
}
export interface IslandLifecycle {
settleSuccess(tag: string): number;
settleFailure(tag: string): {
retryDelayMs: number | null;
attempt: number;
};
evict(tag: 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 declare function createIslandLifecycleCoordinator(opts: {
retries: number;
retryDelay: number;
}): IslandLifecycle;