@fkn/lib
Namespaces
Section titled “Namespaces”Variables
Section titled “Variables”attachFrame
Section titled “attachFrame”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.
Functions
Section titled “Functions”connect()
Section titled “connect()”function connect(): Promise<boolean>;Returns
Section titled “Returns”Promise<boolean>
fetch()
Section titled “fetch()”function fetch(input, init?): Promise<Response>;Parameters
Section titled “Parameters”URL | RequestInfo
RequestInit & object
Returns
Section titled “Returns”Promise<Response>
promptRelay()
Section titled “promptRelay()”function promptRelay(): Promise<string | null>;Returns
Section titled “Returns”Promise<string | null>
relayWorker()
Section titled “relayWorker()”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.
Parameters
Section titled “Parameters”worker
Section titled “worker”Worker
options?
Section titled “options?”originA?
Section titled “originA?”string
originB?
Section titled “originB?”string
unregisterSignal?
Section titled “unregisterSignal?”AbortSignal
Returns
Section titled “Returns”Promise<void>
References
Section titled “References”account
Section titled “account”Re-exports account
AddScriptTagOptions
Section titled “AddScriptTagOptions”Re-exports AddScriptTagOptions
assertAttachableFrameUrl
Section titled “assertAttachableFrameUrl”Re-exports assertAttachableFrameUrl
assertFetchableUrl
Section titled “assertFetchableUrl”Re-exports assertFetchableUrl
AttachCookies
Section titled “AttachCookies”Re-exports AttachCookies
AttachFrameOptions
Section titled “AttachFrameOptions”Re-exports AttachFrameOptions
AttachWindowOptions
Section titled “AttachWindowOptions”Re-exports AttachWindowOptions
BACKGROUND_STOPPED
Section titled “BACKGROUND_STOPPED”Re-exports BACKGROUND_STOPPED
BackgroundStoppedError
Section titled “BackgroundStoppedError”Re-exports BackgroundStoppedError
BlankPage
Section titled “BlankPage”Re-exports BlankPage
ClearCookiesOptions
Section titled “ClearCookiesOptions”Re-exports ClearCookiesOptions
Re-exports cloud
connectButtonUrl
Section titled “connectButtonUrl”Re-exports connectButtonUrl
CookieDetails
Section titled “CookieDetails”Re-exports CookieDetails
cookies
Section titled “cookies”Re-exports cookies
desktop
Section titled “desktop”Re-exports desktop
Re-exports dgram
Re-exports dns
extension
Section titled “extension”Re-exports extension
EXTENSION_ABI
Section titled “EXTENSION_ABI”Re-exports EXTENSION_ABI
ExtensionHandshake
Section titled “ExtensionHandshake”Re-exports ExtensionHandshake
ExtensionOperationUnsupportedError
Section titled “ExtensionOperationUnsupportedError”Re-exports ExtensionOperationUnsupportedError
ExtensionOutdatedError
Section titled “ExtensionOutdatedError”Re-exports ExtensionOutdatedError
FetchInit
Section titled “FetchInit”Re-exports FetchInit
FORGEABLE_HEADERS
Section titled “FORGEABLE_HEADERS”Re-exports FORGEABLE_HEADERS
Re-exports Frame
FrameLocator
Section titled “FrameLocator”Re-exports FrameLocator
FrameWindowBlockedError
Section titled “FrameWindowBlockedError”Re-exports FrameWindowBlockedError
FrameWindowOptions
Section titled “FrameWindowOptions”Re-exports FrameWindowOptions
FrameWindowRefusal
Section titled “FrameWindowRefusal”Re-exports FrameWindowRefusal
FrameWindowRefusedError
Section titled “FrameWindowRefusedError”Re-exports FrameWindowRefusedError
Re-exports fs
GotoOptions
Section titled “GotoOptions”Re-exports GotoOptions
HeaderOperation
Section titled “HeaderOperation”Re-exports HeaderOperation
Re-exports http
isBackgroundStopped
Section titled “isBackgroundStopped”Re-exports isBackgroundStopped
isExtensionExposed
Section titled “isExtensionExposed”Re-exports isExtensionExposed
isLocalNetworkUrl
Section titled “isLocalNetworkUrl”Re-exports isLocalNetworkUrl
isLocatorInvalid
Section titled “isLocatorInvalid”Re-exports isLocatorInvalid
LOCATOR_INVALID
Section titled “LOCATOR_INVALID”Re-exports LOCATOR_INVALID
Re-exports net
Re-exports opfs
packages
Section titled “packages”Re-exports packages
PermissionGrant
Section titled “PermissionGrant”Re-exports PermissionGrant
PermissionRequest
Section titled “PermissionRequest”Re-exports PermissionRequest
permissions
Section titled “permissions”Re-exports permissions
promptInstall
Section titled “promptInstall”Re-exports promptInstall
readExtensionHandshake
Section titled “readExtensionHandshake”Re-exports readExtensionHandshake
RemoteVideoElement
Section titled “RemoteVideoElement”Re-exports RemoteVideoElement
removeRequestHeaderRule
Section titled “removeRequestHeaderRule”Re-exports removeRequestHeaderRule
RequestHeaderRule
Section titled “RequestHeaderRule”Re-exports RequestHeaderRule
REQUIRED_EXTENSION_ABI
Section titled “REQUIRED_EXTENSION_ABI”Re-exports REQUIRED_EXTENSION_ABI
Re-exports rooms
setMissingExtensionHandler
Section titled “setMissingExtensionHandler”Re-exports setMissingExtensionHandler
setRequestHeaderRule
Section titled “setRequestHeaderRule”Re-exports setRequestHeaderRule
SiteCookie
Section titled “SiteCookie”Re-exports SiteCookie
storage
Section titled “storage”Re-exports storage
StorageState
Section titled “StorageState”Re-exports StorageState
StorageStateCookie
Section titled “StorageStateCookie”Re-exports StorageStateCookie
supportsOperation
Section titled “supportsOperation”Re-exports supportsOperation
TimeoutError
Section titled “TimeoutError”Re-exports TimeoutError
waitForExtensionExposure
Section titled “waitForExtensionExposure”Re-exports waitForExtensionExposure
WindowFrame
Section titled “WindowFrame”Re-exports WindowFrame