Browser
Performance telemetry
@silicon-jungle/inkwell-sdk/performanceOpt in to bounded aggregate FPS, frame-time, long-task, visibility and available heap samples.
Exact source · npm package · Reference version 0.0.8
API at a glance
performance.start({ reportIntervalMs? }?): stopFunctionperformance.stop(): voidperformance.snapshot(): PerformanceSnapshot | nullperformance.report(): PerformanceSnapshot | nullsummariseFrameTimes(frameTimes)
The facade calls this module performance; named imports include performanceMonitoring and the start/stop/report/snapshot functions. The default interval is 30 seconds with a 10-second minimum.
Starting replaces the previous monitor. snapshot reads without clearing; report emits and resets the sample window; stop cleans up and may emit a final sample. No active monitor returns null.
Metrics unavailable in the browser are null; these are not raw traces or hardware fingerprints.
All exported symbols
PerformanceMonitorOptionsPerformanceSnapshotperformanceMonitoringreportsnapshotstartstopsummariseFrameTimes
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.
export type PerformanceSnapshot = {
fps: number | null;
frameTimeP95Ms: number | null;
frameTimeMaxMs: number | null;
longTaskCount: number;
longTaskDurationMs: number;
visibility: "visible" | "hidden";
memoryUsedMb: number | null;
};
export type PerformanceMonitorOptions = {
reportIntervalMs?: number;
};
export declare function summariseFrameTimes(frameTimes: readonly number[]): {
fps: null;
frameTimeP95Ms: null;
frameTimeMaxMs: null;
} | {
fps: number;
frameTimeP95Ms: number;
frameTimeMaxMs: number;
};
/** Starts bounded, aggregate-only browser performance sampling. */
export declare function start(options?: PerformanceMonitorOptions): () => void;
export declare function stop(): void;
export declare function report(): PerformanceSnapshot | null;
export declare function snapshot(): PerformanceSnapshot | null;
export declare const performanceMonitoring: Readonly<{
start: typeof start;
stop: typeof stop;
report: typeof report;
snapshot: typeof snapshot;
}>;
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;