Browser
Startup progress and failure
@silicon-jungle/inkwell-sdk/loadingDrive the platform loading UI while the engine starts.
Exact source · npm package · Reference version 0.0.8
API at a glance
loading.progress(ratio: number | null): booleanloading.fail(message: string): booleanprogress(ratio), fail(message), markReady()
Use 0–1 for determinate progress or null for indeterminate progress. Failure messages must be nonempty and at most 500 characters; do not include secrets or internal traces.
Progress and failure return false after startup has finished. markReady is the exported lifecycle primitive; applications should normally call Inkwell.ready().
All exported symbols
failloadingmarkReadyprogress
Exact TypeScript API
Generated from the SDK source, including input options, return values, public types and overloads. Relative imports below are links between SDK source modules, not additional package subpaths. Only the entrypoints listed in the reference index are supported import paths.
/** Report engine startup progress. null displays an indeterminate loading bar. */
export declare function progress(ratio: number | null): boolean;
/** Report a player-readable startup failure. A page reload starts a new lifecycle. */
export declare function fail(message: string): boolean;
/** Internal lifecycle shared by ready() and engine loading helpers. */
export declare function markReady(): boolean;
export declare const loading: Readonly<{
progress: typeof progress;
fail: typeof fail;
}>;
Supporting internal type declarations
These clarify types referenced by the generated signatures; do not import these internal paths directly.
game-services.d.ts
export declare class GameServiceError extends Error {
readonly status: number;
readonly code: string;
constructor(message: string, status?: number, code?: string);
}
export type GameServiceRequest = <T>(service: string, request: Record<string, unknown>) => Promise<T>;
export declare const requestGameService: GameServiceRequest;
/** Server-only adapter. Credentials must never be bundled into browser games. */
export declare function createGameServiceRequest(options: {
baseUrl: string;
token: string;
fetch?: typeof fetch;
}): GameServiceRequest;
protocol.d.ts
export declare const SDK_SOURCE: "inkwell-sdk";
export declare const SDK_VERSION: 1;
export type InkwellMessageType = "ready" | "loading.progress" | "loading.error" | "session.complete" | "analytics.track" | "assets.progress" | "player.get" | "presence.get" | "performance.sample" | "backend.connect" | "backend.fetch";
export type InkwellMessage = {
source: typeof SDK_SOURCE;
version: typeof SDK_VERSION;
type: InkwellMessageType;
payload?: Record<string, unknown>;
sentAt: number;
};
export declare function parentOrigin(): string | null;
export declare function requestId(): string;
export declare function emit(type: InkwellMessageType, payload?: Record<string, unknown>): boolean;