Launch handler
import * as mod from "jsr:@nzip/lofi/recipes/launch-handler";
Opt-in helpers for installed-app launch handling and safe client reuse.
installInstalledAppLaunchConsumer
function
function installInstalledAppLaunchConsumer(options: InstalledAppLaunchConsumerOptions): InstalledAppLaunchConsumer
Feature-detect and install one early launch-queue consumer.
The most recently installed consumer owns the queue. Disposing an older development/HMR generation cannot replace the newer consumer; disposing the current owner installs a no-op consumer so stale callbacks stop handling launches.
installInstalledAppLaunchQueueConsumer
function
function installInstalledAppLaunchQueueConsumer(options: InstalledAppLaunchQueueConsumerOptions): InstalledAppLaunchConsumer
Feature-detect and install one raw launch-queue consumer.
This is the composition seam used by recipes such as file handling. The most recently installed consumer owns the queue, including across different lofi launch recipes. Treat every delivered parameter as untrusted input.
parseInstalledAppLaunchTarget
function
function parseInstalledAppLaunchTarget(targetURL: string | undefined, scopeValue: string | URL): InstalledAppLaunchResult
Parse one browser-provided launch URL against an exact origin and path scope.
InstalledAppLaunchConsumer
type
type InstalledAppLaunchConsumer = {
readonly supported: boolean;
dispose(): void;
};
Result of feature-detecting and registering the launch consumer.
InstalledAppLaunchConsumerOptions
type
type InstalledAppLaunchConsumerOptions = {
scope: string | URL;
queue?: InstalledAppLaunchQueue;
onLaunch(target: InstalledAppLaunchTarget): void;
onRejected?(issue: InstalledAppLaunchIssue): void;
};
Options for registering one launch-queue consumer.
InstalledAppLaunchIssue
type
type InstalledAppLaunchIssue =
| "missing-target"
| "invalid-target"
| "credentialed-target"
| "outside-origin"
| "outside-scope";
Stable rejection that never contains the received launch URL.
InstalledAppLaunchParameters
type
type InstalledAppLaunchParameters = {
targetURL?: string;
files?: readonly FileSystemHandle[];
};
Launch data delivered by a browser LaunchQueue.
InstalledAppLaunchQueue
type
type InstalledAppLaunchQueue = {
setConsumer(consumer: (parameters: InstalledAppLaunchParameters) => void): void;
};
Minimal browser launch-queue seam used by the recipe.
InstalledAppLaunchQueueConsumerOptions
type
type InstalledAppLaunchQueueConsumerOptions = {
queue?: InstalledAppLaunchQueue;
onLaunch(parameters: InstalledAppLaunchParameters): void;
};
Options for registering one raw browser launch-queue consumer.
InstalledAppLaunchResult
type
type InstalledAppLaunchResult = { ok: true; target: InstalledAppLaunchTarget } | { ok: false; issue: InstalledAppLaunchIssue };
Accepted in-scope launch target or value-free rejection.
InstalledAppLaunchTarget
type
type InstalledAppLaunchTarget = {
readonly url: string;
};
A parsed launch URL proven to stay inside the configured application scope.