Skip to content

@fkn/lib

const attachFrame: AttachFrameFunction;

Attaches FKN to an iframe the app mounted, or with { window } opens the attachment in a window of its own. cookies picks the jar and with it the backend (AttachCookies): 'persistent', the default, and 'ephemeral' run on the cloud render proxy whatever is installed, and never wait for the extension; 'native' runs on the extension, waiting for it to expose itself while the page loads (at most 10000 ms) and showing the install prompt when it does not. A blank attach is the cloud render proxy’s alone, so beside 'native' it is a TypeError. frame.backend() says which backend serves an attachment.

A window opens before the first await, so call this directly in the click or key handler whose activation opens it. On 'persistent' or 'ephemeral' it opens on the cloud, extension or not. On 'native' it opens as a real browser window on the extension, with no exposure wait; an extension that does not announce attachWindow, or none at all, is refused at once with ExtensionOperationUnsupportedError (operation 'attachWindow'), before anything opens or is waited for, so the same click can still open one on another value.

function connect(): Promise<boolean>;

Promise<boolean>


function fetch(input, init?): Promise<Response>;

URL | RequestInfo

RequestInit & object

Promise<Response>


function promptRelay(): Promise<string | null>;

Promise<string | null>


function relayWorker(worker, options?): Promise<void>;

Bridges a worker into the FKN API: once called, the worker can import @fkn/lib and use net / dgram exactly like the main thread. Main thread only.

originA (default WEB_ORIGIN) is the targetOrigin for posts to the iframe, originB (default '*') the one for posts to the worker, which enforces none. Pass WEB_ORIGIN for both only when relaying between two windows on the FKN origin.

The page hands its fkn-api channel to the worker for good, and its own calls move to fkn-api-window. Against a cached FKN page from before that channel, the page’s own calls refuse with OwnChannelUnavailableError and FKN’s UI and account changes stay off here until a reload.

Worker

string

string

AbortSignal

Promise<void>

Re-exports account


Re-exports AddScriptTagOptions


Re-exports assertAttachableFrameUrl


Re-exports assertFetchableUrl


Re-exports AttachCookies


Re-exports AttachFrameOptions


Re-exports AttachWindowOptions


Re-exports BACKGROUND_STOPPED


Re-exports BackgroundStoppedError


Re-exports BlankPage


Re-exports ClearCookiesOptions


Re-exports cloud


Re-exports connectButtonUrl


Re-exports CookieDetails


Re-exports cookies


Re-exports desktop


Re-exports dgram


Re-exports dns


Re-exports extension


Re-exports EXTENSION_ABI


Re-exports ExtensionHandshake


Re-exports ExtensionOperationUnsupportedError


Re-exports ExtensionOutdatedError


Re-exports FetchInit


Re-exports FORGEABLE_HEADERS


Re-exports Frame


Re-exports FrameLocator


Re-exports FrameWindowBlockedError


Re-exports FrameWindowOptions


Re-exports FrameWindowRefusal


Re-exports FrameWindowRefusedError


Re-exports fs


Re-exports GotoOptions


Re-exports HeaderOperation


Re-exports http


Re-exports isBackgroundStopped


Re-exports isExtensionExposed


Re-exports isLocalNetworkUrl


Re-exports isLocatorInvalid


Re-exports LOCATOR_INVALID


Re-exports net


Re-exports opfs


Re-exports packages


Re-exports PermissionGrant


Re-exports PermissionRequest


Re-exports permissions


Re-exports promptInstall


Re-exports readExtensionHandshake


Re-exports RemoteVideoElement


Re-exports removeRequestHeaderRule


Re-exports RequestHeaderRule


Re-exports REQUIRED_EXTENSION_ABI


Re-exports rooms


Re-exports setMissingExtensionHandler


Re-exports setRequestHeaderRule


Re-exports SiteCookie


Re-exports storage


Re-exports StorageState


Re-exports StorageStateCookie


Re-exports supportsOperation


Re-exports TimeoutError


Re-exports waitForExtensionExposure


Re-exports WindowFrame