Skip to content

fundamentool


browser

Interfaces

IDownload()

Defined in: src/browser/download.ts:5

ts
IDownload(
   content, 
   type?, 
filename?): Promise<boolean>;

Defined in: src/browser/download.ts:6

Parameters

ParameterType
contentBlobPart | BlobPart[]
type?string
filename?string

Returns

Promise<boolean>

Properties

PropertyTypeDefined in
base(url, filename?) => Promise<boolean>src/browser/download.ts:7

IGetBase64ImageOptions

Defined in: src/browser/getBase64Image.ts:3

Properties

PropertyTypeDescriptionDefined in
height?number-src/browser/getBase64Image.ts:5
left?number-src/browser/getBase64Image.ts:6
top?number-src/browser/getBase64Image.ts:7
type?stringMIME type of resulting image, for example image/png or image/jpeg. Defaults to image/png.src/browser/getBase64Image.ts:12
width?number-src/browser/getBase64Image.ts:4

IWsAsyncConfigs

Defined in: src/browser/wsAsyncRequestProvider.ts:31

Async/idempotent WebSocket request provider configs.

It supports reconnect and matching responses by generated request id.

Properties

PropertyTypeDefined in
generateIdempotencyKey?() => numbersrc/browser/wsAsyncRequestProvider.ts:37
onError?(error) => voidsrc/browser/wsAsyncRequestProvider.ts:34
onMessage?(response) => boolean | voidsrc/browser/wsAsyncRequestProvider.ts:33
onReconnect?(error, run) => anysrc/browser/wsAsyncRequestProvider.ts:35
onSuccessConnect?() => voidsrc/browser/wsAsyncRequestProvider.ts:36
reconnect?booleansrc/browser/wsAsyncRequestProvider.ts:32

IWsSeriesConfigs

Defined in: src/browser/wsSeriesRequestProvider.ts:15

Properties

PropertyTypeDefined in
onError?(error) => voidsrc/browser/wsSeriesRequestProvider.ts:16
onMessage?(response) => boolean | voidsrc/browser/wsSeriesRequestProvider.ts:17
onReconnect?() => anysrc/browser/wsSeriesRequestProvider.ts:18

Type Aliases

TAfterReturningCallback

ts
type TAfterReturningCallback = () => void | Promise<void>;

Defined in: src/routerProvider.ts:37

Returns

void | Promise<void>


TBackLocationResponse

ts
type TBackLocationResponse = {
  locked: boolean;
};

Defined in: src/routerProvider.ts:72

Properties

locked
ts
locked: boolean;

Defined in: src/routerProvider.ts:73


TLinkProps

ts
type TLinkProps = {
  active?: boolean;
  activeAsParent?: boolean;
  component?: React.ElementType;
  onClick?: (event) => void | boolean | Promise<void | boolean>;
  options?: Partial<TUrlProps>;
  timeout?: number;
} & React.HTMLProps<HTMLAnchorElement>;

Defined in: src/routerProvider.ts:45

Type Declaration

NameTypeDefined in
active?booleansrc/routerProvider.ts:49
activeAsParent?booleansrc/routerProvider.ts:50
component?React.ElementTypesrc/routerProvider.ts:51
onClick()?(event) => void | boolean | Promise<void | boolean>src/routerProvider.ts:47
options?Partial<TUrlProps>src/routerProvider.ts:46
timeout?numbersrc/routerProvider.ts:48

TLocationNavigationOptions

ts
type TLocationNavigationOptions = {
  quiet?: boolean;
};

Defined in: src/routerProvider.ts:38

Properties

quiet?
ts
optional quiet?: boolean;

Defined in: src/routerProvider.ts:39


TLocationOptions

ts
type TLocationOptions = TLocationNavigationOptions & {
  onBeforeUnload?:   | TLockWatcherFn
     | TLockWatcher
     | null;
};

Defined in: src/routerProvider.ts:41

Type Declaration

NameTypeDefined in
onBeforeUnload?| TLockWatcherFn | TLockWatcher | nullsrc/routerProvider.ts:42

TLockWatcher

ts
type TLockWatcher = TLockWatcherOptions & {
  callback: TLockWatcherFn;
};

Defined in: src/routerProvider.ts:34

Type Declaration

NameTypeDefined in
callbackTLockWatcherFnsrc/routerProvider.ts:35

TLockWatcherFn

ts
type TLockWatcherFn = (loc) => any | Promise<any>;

Defined in: src/routerProvider.ts:33

Parameters

ParameterType
locTUrlProps

Returns

any | Promise<any>


TLockWatcherOptions

ts
type TLockWatcherOptions = {
  backwards?: boolean;
  forwards?: boolean;
};

Defined in: src/routerProvider.ts:29

Properties

backwards?
ts
optional backwards?: boolean;

Defined in: src/routerProvider.ts:30

forwards?
ts
optional forwards?: boolean;

Defined in: src/routerProvider.ts:31


TPushLocation

ts
type TPushLocation = (extendsLocation, options?) => Promise<TUrlProps>;

Defined in: src/routerProvider.ts:54

Parameters

ParameterType
extendsLocationPartial<TUrlProps>
options?TLocationOptions

Returns

Promise<TUrlProps>


TRoute

ts
type TRoute = {
  index: number;
  params: TParams;
} & TRouterState & Record<string, any>;

Defined in: src/routerProvider.ts:66

Type Declaration

NameTypeDefined in
indexnumbersrc/routerProvider.ts:67
paramsTParamssrc/routerProvider.ts:68

TRouteArgs

ts
type TRouteArgs<T> = [string, TRouteHandler<T> | T];

Defined in: src/routerProvider.ts:28

Type Parameters

Type Parameter
T

TRouteHandler

ts
type TRouteHandler<T> = (params, location) => T | undefined | null;

Defined in: src/routerProvider.ts:27

Type Parameters

Type Parameter
T

Parameters

ParameterType
paramsTParams
locationTUrlProps

Returns

T | undefined | null


TRouteProps

ts
type TRouteProps = {
  active: boolean;
  route: TRoute;
};

Defined in: src/routerProvider.ts:23

Properties

active
ts
active: boolean;

Defined in: src/routerProvider.ts:25

route
ts
route: TRoute;

Defined in: src/routerProvider.ts:24


TRouter

ts
type TRouter = ReturnType<TRouterProvider>;

Defined in: src/routerProvider.ts:1107


TRouterProvider

ts
type TRouterProvider = typeof routerProvider;

Defined in: src/routerProvider.ts:1106


TRouterProviderOptions

ts
type TRouterProviderOptions = {
  Component: React.ElementType;
  createApi: <T, E>(store, shape) => { [K in keyof E]: (payload: Parameters<E[K]>[1]) => void };
  createElement: (...args) => any;
  createStore: <T>(initial) => StoreWritable<T>;
  forwardRef: (...args) => any;
  useEffect: (...args) => void;
  window: Window;
};

Defined in: src/routerProvider.ts:247

The router provider options.

Param

The window.

Param

The component.

Param

The useEffect.

Param

The createElement.

Param

The forwardRef.

Param

The createStore.

Param

The createApi.

Example

ts
routerProviderBase({ window: window, Component: Component, useEffect: useEffect, createElement: createElement, forwardRef: forwardRef, createStore: createStore, createApi: createApi }); // => <Router />

Properties

Component
ts
Component: React.ElementType;

Defined in: src/routerProvider.ts:249

createApi
ts
createApi: <T, E>(store, shape) => { [K in keyof E]: (payload: Parameters<E[K]>[1]) => void };

Defined in: src/routerProvider.ts:254

Type Parameters
Type Parameter
T
E extends Record<string, (state, payload) => T>
Parameters
ParameterType
storeStoreWritable<T>
shapeE
Returns

{ [K in keyof E]: (payload: Parameters<E[K]>[1]) => void }

createElement
ts
createElement: (...args) => any;

Defined in: src/routerProvider.ts:251

Parameters
ParameterType
...argsany[]
Returns

any

createStore
ts
createStore: <T>(initial) => StoreWritable<T>;

Defined in: src/routerProvider.ts:253

Type Parameters
Type Parameter
T
Parameters
ParameterType
initialT
Returns

StoreWritable<T>

forwardRef
ts
forwardRef: (...args) => any;

Defined in: src/routerProvider.ts:252

Parameters
ParameterType
...argsany[]
Returns

any

useEffect
ts
useEffect: (...args) => void;

Defined in: src/routerProvider.ts:250

Parameters
ParameterType
...argsany[]
Returns

void

window
ts
window: Window;

Defined in: src/routerProvider.ts:248


TRouterState

ts
type TRouterState = {
  depth: number;
  history: (TUrlProps | null)[];
  location: TUrlProps;
  prev: null | TUrlProps;
};

Defined in: src/routerProvider.ts:59

Properties

depth
ts
depth: number;

Defined in: src/routerProvider.ts:60

history
ts
history: (TUrlProps | null)[];

Defined in: src/routerProvider.ts:63

location
ts
location: TUrlProps;

Defined in: src/routerProvider.ts:62

prev
ts
prev: null | TUrlProps;

Defined in: src/routerProvider.ts:61

Variables

DEFAULT_LOCK_WATCHER_OPTIONS

ts
const DEFAULT_LOCK_WATCHER_OPTIONS: {
  backwards: boolean;
  forwards: boolean;
};

Defined in: src/routerProvider.ts:86

The default lock watcher options.

Type Declaration

NameTypeDefault valueDefined in
backwardsbooleantruesrc/routerProvider.ts:88
forwardsbooleanfalsesrc/routerProvider.ts:87

download

ts
const download: IDownload;

Defined in: src/browser/download.ts:22

Triggers a file download in the browser using a temporary <a> element.

Param

The content to download. Can be a string, ArrayBuffer, BlobPart, or an array of BlobPart.

Param

Optional MIME type for the created blob.

Param

Optional filename for the downloaded file.

Returns

A promise that resolves to true if the download was successful.

Example

ts
await download('hello world', 'text/plain', 'hello.txt');

getViewportSize

ts
const getViewportSize: () => [number, number];

Defined in: src/browser/getViewportSize.ts:12

Gets viewport size for the current window.

Returns

[number, number]

{ width, height } of the current viewport.

Example

ts
const { width, height } = getViewportSize();

ready

ts
const ready: TReadyFn;

Defined in: src/browser/ready.ts:14

DOM ready helper for the current window. Executes the callback immediately if the document is already ready, or queues it until it becomes ready.

Param

Function to call when the DOM is ready.

Example

ts
ready(() => console.log('DOM is ready'));

script

ts
const script: IScript;

Defined in: src/browser/script.ts:20

Loads a script by URL (with optional query options) and resolves when loaded.

Param

The URL of the script to load.

Param

The options for the script.

Returns

A promise that resolves when the script is loaded.

Example

ts
await script('https://cdn.example.com/lib.js');

toArrayBuffer

ts
const toArrayBuffer: (blob) => Promise<ArrayBuffer>;

Defined in: src/browser/blob/index.ts:9

Parameters

ParameterType
blobBlob

Returns

Promise<ArrayBuffer>


toBase64Url

ts
const toBase64Url: (blob) => Promise<string>;

Defined in: src/browser/blob/index.ts:8

Parameters

ParameterType
blobBlob

Returns

Promise<string>


toText

ts
const toText: (blob) => Promise<string>;

Defined in: src/browser/blob/index.ts:7

Parameters

ParameterType
blobBlob

Returns

Promise<string>

Functions

convertBlobToBase64()

ts
function convertBlobToBase64(blob): Promise<string>;

Defined in: src/browser/convertBlobToBase64.ts:9

Reads a Blob and resolves with a base64 data URL string.

Parameters

ParameterTypeDescription
blobBlobThe Blob to convert.

Returns

Promise<string>

Promise resolved with a base64 data URL string.

Example

ts
const dataUrl = await convertBlobToBase64(new Blob(['hello']));

convertUrlToBase64()

ts
function convertUrlToBase64(url): Promise<string>;

Defined in: src/browser/convertUrlToBase64.ts:14

Converts a URL to a base64 data URL.

Implementation: URL -> Blob -> base64.

Parameters

ParameterTypeDescription
urlstringResource URL.

Returns

Promise<string>

Promise resolved with a base64 data URL string.

Example

ts
const base64 = await convertUrlToBase64('https://example.com/img.png');

convertUrlToBlob()

ts
function convertUrlToBlob(url): Promise<Blob>;

Defined in: src/browser/convertUrlToBlob.ts:9

Fetches a URL and resolves with its response body as a Blob.

Parameters

ParameterTypeDescription
urlstringResource URL.

Returns

Promise<Blob>

Promise resolved with a Blob.

Example

ts
const blob = await convertUrlToBlob('https://example.com/img.png');

copyTextToClipboard()

ts
function copyTextToClipboard(text, win?): void;

Defined in: src/copyTextToClipboard.ts:14

Copy text to clipboard.

Uses the modern navigator.clipboard.writeText API when available, and falls back to a hidden textarea + document.execCommand('copy') in older environments.

Parameters

ParameterTypeDescription
textstringText content to copy.
win?{ document?: any; navigator?: any; }Optional window-like object, used mainly for testing.
win.document?any-
win.navigator?any-

Returns

void

Example

ts
copyTextToClipboard('Hello, World!');
// Copies "Hello, World!" to the system clipboard

createAnimationFrame()

ts
function createAnimationFrame(callback, interval?): () => void;

Defined in: src/createAnimationFrame.ts:13

Creates an animation frame.

Parameters

ParameterTypeDescription
callback(balance) => voidThe callback to call when the animation frame is ready.
interval?numberThe interval to call the callback.

Returns

The function to stop the animation frame.

() => void

Example

ts
const stop = createAnimationFrame((balance) => {
  console.log('tick', balance);
}, 100);
stop(); // stops the animation frame loop

detection()

ts
function detection(userAgent, output?): string;

Defined in: src/browser/detection.ts:21

Detects user agent tokens and versions from the given userAgent string.

Parameters

ParameterTypeDescription
userAgentstringRaw user agent string.
output?string[]Optional array to append detection tokens into.

Returns

string

Space-separated string of detected tokens.

Example

ts
detection('Mozilla/5.0 ... Chrome/100'); // => 'chrome chrome-100'

detectionByWindow()

ts
function detectionByWindow(windowObj, output?): string;

Defined in: src/browser/detectionByWindow.ts:24

Detects environment flags based on window object and userAgent.

Parameters

ParameterTypeDescription
windowObjIWindowLikeWindow-like object.
output?string[]Optional array to append detection tokens into.

Returns

string

Space-separated string of detected tokens.

Example

ts
detectionByWindow(window); // => 'chrome chrome-100 multitouch'

dynamic()

ts
function dynamic(url, options?): Promise<void>;

Defined in: src/browser/dynamic.ts:16

Dynamically loads an external script with caching. Subsequent calls with the same resolved URL return the cached promise.

Parameters

ParameterTypeDescription
urlstringScript URL.
options?Record<string, any>Optional URL extension options.

Returns

Promise<void>

Promise resolved when the script is loaded.

Example

ts
await dynamic('https://cdn.example.com/lib.js');

dynamicModule()

ts
function dynamicModule<TOptions, TResult>(init): (options?) => Promise<TResult>;

Defined in: src/browser/dynamicModule.ts:10

Wraps async module initializer so that it is executed only once.

Type Parameters

Type ParameterDefault type
TOptions extends Record<string, any>Record<string, any>
TResultany

Parameters

ParameterTypeDescription
init(options?) => TResult | Promise<TResult>The initializer function.

Returns

A function that returns a Promise resolved with the initializer result (cached after first call).

(options?) => Promise<TResult>

Example

ts
const loadLib = dynamicModule(() => import('./heavy-module'));
await loadLib(); // runs init only once; subsequent calls return the cached result

from()

ts
function from(content, type?): any;

Defined in: src/browser/blob/from.ts:43

Normalizes input into a Blob.

Rules:

  • Blob: returned as-is
  • ArrayBuffer/buffer-like: stored as binary (application/octet-binary)
  • Plain object: JSON-stringified (application/json)
  • Other defined primitives: stringified as text/plain

Parameters

ParameterTypeDescription
contentanyAny value to wrap into a Blob.
type?stringOptional MIME type override.

Returns

any

A Blob instance containing the normalized content.

Example

ts
from('hello');           // => Blob (text/plain)
from({ a: 1 });          // => Blob (application/json)
from(new ArrayBuffer(4)); // => Blob (application/octet-binary)

getBase64Image()

ts
function getBase64Image(url, options?): Promise<string>;

Defined in: src/browser/getBase64Image.ts:24

Loads an image by URL and converts it to a base64 data URL using a canvas.

Parameters

ParameterTypeDescription
urlstringImage source URL.
optionsIGetBase64ImageOptionsOptional rendering options such as size, crop position and MIME type.

Returns

Promise<string>

Promise resolved with the generated data URL string.

Example

ts
const dataUrl = await getBase64Image('https://example.com/img.png');

ts
function getDataLink(content, type?): string;

Defined in: src/browser/getDataLink.ts:13

Creates a blob URL for the given content and MIME type using the native Blob constructor.

This function replaces the legacy blob/from helper by using the native Blob constructor directly.

Parameters

ParameterTypeDescription
contentBlobPart | BlobPart[]Data to wrap into a Blob. Can be a string, ArrayBuffer, BlobPart, etc.
type?stringOptional MIME type for the created blob.

Returns

string

A blob URL string created via URL.createObjectURL.

Example

ts
const url = getDataLink('hello', 'text/plain'); // => 'blob:...'

getImageByUrl()

ts
function getImageByUrl(url): Promise<HTMLImageElement>;

Defined in: src/browser/getImageByUrl.ts:10

Loads an image from the given URL and resolves with the created Image element.

Parameters

ParameterTypeDescription
urlstringImage source URL.

Returns

Promise<HTMLImageElement>

Promise resolved with the loaded HTMLImageElement.

Example

ts
const img = await getImageByUrl('https://example.com/img.png');
img.naturalWidth; // => 800

getImageNaturalSizeByUrl()

ts
function getImageNaturalSizeByUrl(url): Promise<[number, number]>;

Defined in: src/browser/getImageNaturalSizeByUrl.ts:11

Loads an image by URL and resolves with its natural size.

Parameters

ParameterTypeDescription
urlstringImage source URL.

Returns

Promise<[number, number]>

Promise resolved with a tuple [width, height].

Example

ts
const [w, h] = await getImageNaturalSizeByUrl('https://example.com/img.png');

hashRouterProvider()

ts
function hashRouterProvider(options): {
  $hashLocation: Store<TUrlProps>;
  $hashPath: Store<string>;
  $hashQuery: Store<TParams>;
  $historyDepth: StoreWritable<number>;
  $immeidateHashLocation: Store<TUrlProps>;
  $immeidateHashPath: Store<string>;
  $immeidateHashQuery: Store<TParams>;
  $immeidateLocation: Store<TUrlProps>;
  $immeidatePath: Store<string>;
  $immeidateQuery: Store<TParams>;
  $location: Store<TUrlProps>;
  $path: Store<string>;
  $prevHashLocation: Store<TUrlProps>;
  $prevHashPath: Store<string>;
  $prevHashQuery: Store<TParams>;
  $prevLocation: Store<{
  }>;
  $prevPath: Store<string>;
  $prevQuery: Store<TParams>;
  $query: Store<TParams>;
  $state: StoreWritable<TRouterState>;
  $stateHash: Store<{
     current: Partial<TUrlProps>;
     depth: number;
     history: TUrlProps[];
     location: TUrlProps;
     prev: Partial<TUrlProps>;
  }>;
  $trasitionState: StoreWritable<TRouterState>;
  $trasitionStateHash: Store<{
     depth: number;
     history: TUrlProps[];
     location: Partial<TUrlProps>;
     prev: Partial<TUrlProps>;
  }>;
  backLocation: (...args) => Promise<any>;
  backLocationThrottled: (...args) => Promise<void>;
  backRepeat: (count, options?) => Promise<any>;
  backToDepth: (...args) => Promise<any>;
  backToStart: (options?) => Promise<any>;
  getCurrentHashLocation: () => Partial<TUrlProps>;
  getCurrentLocation: () => TUrlProps;
  getFromHashLocation: () => Partial<TUrlProps>;
  getFromLocation: () => TUrlProps;
  getHistory: () => TUrlProps[];
  getNextHashLocation: () => Partial<TUrlProps>;
  getNextLocation: () => TUrlProps;
  getPrevHashLocation: () => any;
  getPrevLocation: () => any;
  HashLink: ElementType<any, keyof IntrinsicElements>;
  HashNavLink: ElementType<any, keyof IntrinsicElements>;
  hashParamReplaceStorage: {
     clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     get: (key) => any;
     getKeys: () => string[];
     remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     watch: (watcher) => Unsubscribe;
  };
  hashParamStorage: {
     clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     get: (key) => any;
     getKeys: () => string[];
     remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     watch: (watcher) => Unsubscribe;
  };
  isTryClosingCurrentLocation: () => boolean;
  isTryClosingLocation: (depth) => boolean;
  isWaitingUnloadCurrentLocation: () => boolean;
  isWaitingUnloadLocation: (depth) => boolean;
  Link: ElementType<any, keyof IntrinsicElements>;
  LinkProvider: (__namedParameters) => ElementType;
  NavLink: ElementType<any, keyof IntrinsicElements>;
  onBeforeUnload: (callback, options?) => () => void;
  paramReplaceStorage: {
     clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     get: (key) => any;
     getKeys: () => string[];
     remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     watch: (watcher) => Unsubscribe;
  };
  paramStorage: {
     clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     get: (key) => any;
     getKeys: () => string[];
     remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     watch: (watcher) => Unsubscribe;
  };
  paramStorageProvider: ($query, pushLocation) => {
     clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     get: (key) => any;
     getKeys: () => string[];
     remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     watch: (watcher) => Unsubscribe;
  };
  pushHashLocation: (child, options?) => Promise<any>;
  pushLocation: (extendsLocation, options?) => Promise<any>;
  pushLocationThrottled: (...args) => Promise<void>;
  pushParam: (query) => Promise<any>;
  replaceHashLocation: (child, options?) => Promise<any>;
  replaceLocation: (extendsLocation, options?) => Promise<any>;
  replaceLocationThrottled: (...args) => Promise<void>;
  replaceParam: (query) => Promise<any>;
  routerByHashLocationProvider: <T>(routes, notFoundHandler?) => Store<T & {
     index: number;
     params: TParams;
  } & TRouterState & Record<string, any>>;
  routerByLocationProvider: <T>(routes, notFoundHandler?) => Store<T & {
     index: number;
     params: TParams;
  } & TRouterState & Record<string, any>>;
  routerForObservableMapProvider: <T>(_routes, notFoundHandler?) => (state) => T & {
     index: number;
     params: TParams;
  } & TRouterState & Record<string, any>;
  storagePushHashLocation: (child, options?) => Promise<any>;
  storagePushLocation: (extendsLocation, options?) => Promise<any>;
  storageReplaceHashLocation: (child, options?) => Promise<any>;
  storageReplaceLocation: (extendsLocation, options?) => Promise<any>;
  useRouteIsFocus: (effect, deps?) => void;
};

Defined in: src/routerProvider.ts:1069

Parameters

ParameterType
optionsTRouterProviderOptions

Returns

NameTypeDefined in
$hashLocationStore<TUrlProps>src/routerProvider.ts:973
$hashPathStore<string>src/routerProvider.ts:975
$hashQueryStore<TParams>src/routerProvider.ts:974
$historyDepthStoreWritable<number>src/routerProvider.ts:965
$immeidateHashLocationStore<TUrlProps>src/routerProvider.ts:980
$immeidateHashPathStore<string>src/routerProvider.ts:982
$immeidateHashQueryStore<TParams>src/routerProvider.ts:981
$immeidateLocationStore<TUrlProps>src/routerProvider.ts:977
$immeidatePathStore<string>src/routerProvider.ts:979
$immeidateQueryStore<TParams>src/routerProvider.ts:978
$locationStore<TUrlProps>src/routerProvider.ts:970
$pathStore<string>src/routerProvider.ts:972
$prevHashLocationStore<TUrlProps>src/routerProvider.ts:987
$prevHashPathStore<string>src/routerProvider.ts:989
$prevHashQueryStore<TParams>src/routerProvider.ts:988
$prevLocationStore<{ }>src/routerProvider.ts:984
$prevPathStore<string>src/routerProvider.ts:986
$prevQueryStore<TParams>src/routerProvider.ts:985
$queryStore<TParams>src/routerProvider.ts:971
$stateStoreWritable<TRouterState>src/routerProvider.ts:968
$stateHashStore<{ current: Partial<TUrlProps>; depth: number; history: TUrlProps[]; location: TUrlProps; prev: Partial<TUrlProps>; }>src/routerProvider.ts:969
$trasitionStateStoreWritable<TRouterState>src/routerProvider.ts:966
$trasitionStateHashStore<{ depth: number; history: TUrlProps[]; location: Partial<TUrlProps>; prev: Partial<TUrlProps>; }>src/routerProvider.ts:967
backLocation()(...args) => Promise<any>src/routerProvider.ts:1021
backLocationThrottled()(...args) => Promise<void>src/routerProvider.ts:1065
backRepeat()(count, options?) => Promise<any>src/routerProvider.ts:1023
backToDepth()(...args) => Promise<any>src/routerProvider.ts:1022
backToStart()(options?) => Promise<any>src/routerProvider.ts:1024
getCurrentHashLocation()() => Partial<TUrlProps>src/routerProvider.ts:1006
getCurrentLocation()() => TUrlPropssrc/routerProvider.ts:1005
getFromHashLocation()() => Partial<TUrlProps>src/routerProvider.ts:1012
getFromLocation()() => TUrlPropssrc/routerProvider.ts:1009
getHistory()() => TUrlProps[]src/routerProvider.ts:1004
getNextHashLocation()() => Partial<TUrlProps>src/routerProvider.ts:1011
getNextLocation()() => TUrlPropssrc/routerProvider.ts:1008
getPrevHashLocation()() => anysrc/routerProvider.ts:1010
getPrevLocation()() => anysrc/routerProvider.ts:1007
HashLinkElementType<any, keyof IntrinsicElements>src/routerProvider.ts:1002
HashNavLinkElementType<any, keyof IntrinsicElements>src/routerProvider.ts:1003
hashParamReplaceStorage{ clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; get: (key) => any; getKeys: () => string[]; remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; watch: (watcher) => Unsubscribe; }src/routerProvider.ts:999
hashParamReplaceStorage.clear()() => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:896
hashParamReplaceStorage.get()(key) => anysrc/routerProvider.ts:893
hashParamReplaceStorage.getKeys()() => string[]src/routerProvider.ts:895
hashParamReplaceStorage.remove()(key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:894
hashParamReplaceStorage.set()(key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:892
hashParamReplaceStorage.watch()(watcher) => Unsubscribesrc/routerProvider.ts:900
hashParamStorage{ clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; get: (key) => any; getKeys: () => string[]; remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; watch: (watcher) => Unsubscribe; }src/routerProvider.ts:997
hashParamStorage.clear()() => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:896
hashParamStorage.get()(key) => anysrc/routerProvider.ts:893
hashParamStorage.getKeys()() => string[]src/routerProvider.ts:895
hashParamStorage.remove()(key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:894
hashParamStorage.set()(key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:892
hashParamStorage.watch()(watcher) => Unsubscribesrc/routerProvider.ts:900
isTryClosingCurrentLocation()() => booleansrc/routerProvider.ts:1027
isTryClosingLocation()(depth) => booleansrc/routerProvider.ts:1025
isWaitingUnloadCurrentLocation()() => booleansrc/routerProvider.ts:1028
isWaitingUnloadLocation()(depth) => booleansrc/routerProvider.ts:1026
LinkElementType<any, keyof IntrinsicElements>src/routerProvider.ts:1000
LinkProvider()(__namedParameters) => ElementTypesrc/routerProvider.ts:991
NavLinkElementType<any, keyof IntrinsicElements>src/routerProvider.ts:1001
onBeforeUnload()(callback, options?) => () => voidsrc/routerProvider.ts:1029
paramReplaceStorage{ clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; get: (key) => any; getKeys: () => string[]; remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; watch: (watcher) => Unsubscribe; }src/routerProvider.ts:998
paramReplaceStorage.clear()() => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:896
paramReplaceStorage.get()(key) => anysrc/routerProvider.ts:893
paramReplaceStorage.getKeys()() => string[]src/routerProvider.ts:895
paramReplaceStorage.remove()(key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:894
paramReplaceStorage.set()(key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:892
paramReplaceStorage.watch()(watcher) => Unsubscribesrc/routerProvider.ts:900
paramStorage{ clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; get: (key) => any; getKeys: () => string[]; remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; watch: (watcher) => Unsubscribe; }src/routerProvider.ts:996
paramStorage.clear()() => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:896
paramStorage.get()(key) => anysrc/routerProvider.ts:893
paramStorage.getKeys()() => string[]src/routerProvider.ts:895
paramStorage.remove()(key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:894
paramStorage.set()(key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:892
paramStorage.watch()(watcher) => Unsubscribesrc/routerProvider.ts:900
paramStorageProvider()($query, pushLocation) => { clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; get: (key) => any; getKeys: () => string[]; remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; watch: (watcher) => Unsubscribe; }src/routerProvider.ts:993
pushHashLocation()(child, options?) => Promise<any>src/routerProvider.ts:1015
pushLocation()(extendsLocation, options?) => Promise<any>src/routerProvider.ts:1013
pushLocationThrottled()(...args) => Promise<void>src/routerProvider.ts:1063
pushParam()(query) => Promise<any>src/routerProvider.ts:1057
replaceHashLocation()(child, options?) => Promise<any>src/routerProvider.ts:1016
replaceLocation()(extendsLocation, options?) => Promise<any>src/routerProvider.ts:1014
replaceLocationThrottled()(...args) => Promise<void>src/routerProvider.ts:1064
replaceParam()(query) => Promise<any>src/routerProvider.ts:1060
routerByHashLocationProvider()<T>(routes, notFoundHandler?) => Store<T & { index: number; params: TParams; } & TRouterState & Record<string, any>>src/routerProvider.ts:995
routerByLocationProvider()<T>(routes, notFoundHandler?) => Store<T & { index: number; params: TParams; } & TRouterState & Record<string, any>>src/routerProvider.ts:994
routerForObservableMapProvider()<T>(_routes, notFoundHandler?) => (state) => T & { index: number; params: TParams; } & TRouterState & Record<string, any>src/routerProvider.ts:992
storagePushHashLocation()(child, options?) => Promise<any>src/routerProvider.ts:1018
storagePushLocation()(extendsLocation, options?) => Promise<any>src/routerProvider.ts:1017
storageReplaceHashLocation()(child, options?) => Promise<any>src/routerProvider.ts:1020
storageReplaceLocation()(extendsLocation, options?) => Promise<any>src/routerProvider.ts:1019
useRouteIsFocus()(effect, deps?) => voidsrc/routerProvider.ts:1031

jsonpRequest()

ts
function jsonpRequest(url, params?): Promise<unknown>;

Defined in: src/browser/jsonpRequest.ts:18

Performs JSONP request by injecting a temporary <script> tag.

The callback function is placed on GLOBAL_CONTEXT so the remote endpoint can call it when it finishes.

Parameters

ParameterTypeDescription
urlstringBase request URL (without callback param).
params?Record<string, any>Query params appended to the URL.

Returns

Promise<unknown>

Promise resolved with the JSONP callback payload.

Example

ts
const data = await jsonpRequest('https://api.example.com/data', { id: 1 });

mergeLocation()

ts
function mergeLocation(prev, exten): TUrlProps;

Defined in: src/routerProvider.ts:100

Merges two URL properties.

Parameters

ParameterTypeDescription
prevPartial<TUrlProps>The previous URL properties.
extenPartial<TUrlProps>-

Returns

TUrlProps

The merged URL properties.

Example

ts
mergeLocation({ path: '/user', query: { id: 1 } }, { path: '/user/1', query: { name: 'John' } }); // => { path: '/user/1', query: { id: 1, name: 'John' } }

ts
function openLink(url, timeout?): Promise<void>;

Defined in: src/browser/openLink.ts:13

Opens the given URL in a new browser tab using a temporary <a> element. Returns a Promise that resolves after a short timeout, useful for tests or when waiting for the navigation to be scheduled.

Parameters

ParameterTypeDescription
urlstringURL to open.
timeout?numberTimeout in ms before the promise resolves (default: 100).

Returns

Promise<void>

Promise resolved after the given timeout.

Example

ts
await openLink('https://example.com'); // opens in new tab

provider()

ts
function provider<TResult>(fnName): (blob) => Promise<TResult>;

Defined in: src/browser/blob/provider.ts:13

Creates a Blob -> Promise<TResult> converter based on FileReader method name.

Example: provider('readAsText') produces a function that reads a blob as text.

Type Parameters

Type ParameterDefault type
TResultstring | ArrayBuffer

Parameters

ParameterTypeDescription
fnNamestringFileReader method name (e.g. readAsText, readAsDataURL).

Returns

A function that reads a Blob using the given FileReader method.

(blob) => Promise<TResult>

Example

ts
const toText = provider('readAsText');
const text = await toText(blob); // => 'hello'

routerByLocationProviderProvider()

ts
function routerByLocationProviderProvider<A>($state): <T>(routes, notFoundHandler?) => Store<T & {
  index: number;
  params: TParams;
} & TRouterState & Record<string, any>>;

Defined in: src/routerProvider.ts:224

Creates a router for a location.

Type Parameters

Type Parameter
A extends TRouterState

Parameters

ParameterTypeDescription
$stateStore<A>The state.

Returns

A router.

<T>(routes, notFoundHandler?) => Store<T & { index: number; params: TParams; } & TRouterState & Record<string, any>>

Example

ts
routerByLocationProviderProvider($state); // => <Router />

routerForObservableMapProvider()

ts
function routerForObservableMapProvider<T>(_routes, notFoundHandler?): (state) => T & {
  index: number;
  params: TParams;
} & TRouterState & Record<string, any>;

Defined in: src/routerProvider.ts:167

Creates a router for an observable map.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
_routesTRouteArgs<T>[]The routes.
notFoundHandler?TRouteHandler<T>The not found handler.

Returns

A router.

(state) => T & { index: number; params: TParams; } & TRouterState & Record<string, any>

Example

ts
routerForObservableMapProvider([['/user', (params, location) => <User />]], (params, location) => <NotFound />); // => <Router />

routerProvider()

ts
function routerProvider(options): {
  $hashLocation: Store<TUrlProps>;
  $hashPath: Store<string>;
  $hashQuery: Store<TParams>;
  $historyDepth: StoreWritable<number>;
  $immeidateHashLocation: Store<TUrlProps>;
  $immeidateHashPath: Store<string>;
  $immeidateHashQuery: Store<TParams>;
  $immeidateLocation: Store<TUrlProps>;
  $immeidatePath: Store<string>;
  $immeidateQuery: Store<TParams>;
  $location: Store<TUrlProps>;
  $path: Store<string>;
  $prevHashLocation: Store<TUrlProps>;
  $prevHashPath: Store<string>;
  $prevHashQuery: Store<TParams>;
  $prevLocation: Store<{
  }>;
  $prevPath: Store<string>;
  $prevQuery: Store<TParams>;
  $query: Store<TParams>;
  $state: StoreWritable<TRouterState>;
  $stateHash: Store<{
     current: Partial<TUrlProps>;
     depth: number;
     history: TUrlProps[];
     location: TUrlProps;
     prev: Partial<TUrlProps>;
  }>;
  $trasitionState: StoreWritable<TRouterState>;
  $trasitionStateHash: Store<{
     depth: number;
     history: TUrlProps[];
     location: Partial<TUrlProps>;
     prev: Partial<TUrlProps>;
  }>;
  backLocation: (...args) => Promise<any>;
  backLocationThrottled: (...args) => Promise<void>;
  backRepeat: (count, options?) => Promise<any>;
  backToDepth: (...args) => Promise<any>;
  backToStart: (options?) => Promise<any>;
  getCurrentHashLocation: () => Partial<TUrlProps>;
  getCurrentLocation: () => TUrlProps;
  getFromHashLocation: () => Partial<TUrlProps>;
  getFromLocation: () => TUrlProps;
  getHistory: () => TUrlProps[];
  getNextHashLocation: () => Partial<TUrlProps>;
  getNextLocation: () => TUrlProps;
  getPrevHashLocation: () => any;
  getPrevLocation: () => any;
  HashLink: ElementType<any, keyof IntrinsicElements>;
  HashNavLink: ElementType<any, keyof IntrinsicElements>;
  hashParamReplaceStorage: {
     clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     get: (key) => any;
     getKeys: () => string[];
     remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     watch: (watcher) => Unsubscribe;
  };
  hashParamStorage: {
     clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     get: (key) => any;
     getKeys: () => string[];
     remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     watch: (watcher) => Unsubscribe;
  };
  isTryClosingCurrentLocation: () => boolean;
  isTryClosingLocation: (depth) => boolean;
  isWaitingUnloadCurrentLocation: () => boolean;
  isWaitingUnloadLocation: (depth) => boolean;
  Link: ElementType<any, keyof IntrinsicElements>;
  LinkProvider: (__namedParameters) => ElementType;
  NavLink: ElementType<any, keyof IntrinsicElements>;
  onBeforeUnload: (callback, options?) => () => void;
  paramReplaceStorage: {
     clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     get: (key) => any;
     getKeys: () => string[];
     remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     watch: (watcher) => Unsubscribe;
  };
  paramStorage: {
     clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     get: (key) => any;
     getKeys: () => string[];
     remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     watch: (watcher) => Unsubscribe;
  };
  paramStorageProvider: ($query, pushLocation) => {
     clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     get: (key) => any;
     getKeys: () => string[];
     remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; };
     watch: (watcher) => Unsubscribe;
  };
  pushHashLocation: (child, options?) => Promise<any>;
  pushLocation: (extendsLocation, options?) => Promise<any>;
  pushLocationThrottled: (...args) => Promise<void>;
  pushParam: (query) => Promise<any>;
  replaceHashLocation: (child, options?) => Promise<any>;
  replaceLocation: (extendsLocation, options?) => Promise<any>;
  replaceLocationThrottled: (...args) => Promise<void>;
  replaceParam: (query) => Promise<any>;
  routerByHashLocationProvider: <T>(routes, notFoundHandler?) => Store<T & {
     index: number;
     params: TParams;
  } & TRouterState & Record<string, any>>;
  routerByLocationProvider: <T>(routes, notFoundHandler?) => Store<T & {
     index: number;
     params: TParams;
  } & TRouterState & Record<string, any>>;
  routerForObservableMapProvider: <T>(_routes, notFoundHandler?) => (state) => T & {
     index: number;
     params: TParams;
  } & TRouterState & Record<string, any>;
  storagePushHashLocation: (child, options?) => Promise<any>;
  storagePushLocation: (extendsLocation, options?) => Promise<any>;
  storageReplaceHashLocation: (child, options?) => Promise<any>;
  storageReplaceLocation: (extendsLocation, options?) => Promise<any>;
  useRouteIsFocus: (effect, deps?) => void;
};

Defined in: src/routerProvider.ts:1047

Parameters

ParameterType
optionsTRouterProviderOptions

Returns

NameTypeDefined in
$hashLocationStore<TUrlProps>src/routerProvider.ts:973
$hashPathStore<string>src/routerProvider.ts:975
$hashQueryStore<TParams>src/routerProvider.ts:974
$historyDepthStoreWritable<number>src/routerProvider.ts:965
$immeidateHashLocationStore<TUrlProps>src/routerProvider.ts:980
$immeidateHashPathStore<string>src/routerProvider.ts:982
$immeidateHashQueryStore<TParams>src/routerProvider.ts:981
$immeidateLocationStore<TUrlProps>src/routerProvider.ts:977
$immeidatePathStore<string>src/routerProvider.ts:979
$immeidateQueryStore<TParams>src/routerProvider.ts:978
$locationStore<TUrlProps>src/routerProvider.ts:970
$pathStore<string>src/routerProvider.ts:972
$prevHashLocationStore<TUrlProps>src/routerProvider.ts:987
$prevHashPathStore<string>src/routerProvider.ts:989
$prevHashQueryStore<TParams>src/routerProvider.ts:988
$prevLocationStore<{ }>src/routerProvider.ts:984
$prevPathStore<string>src/routerProvider.ts:986
$prevQueryStore<TParams>src/routerProvider.ts:985
$queryStore<TParams>src/routerProvider.ts:971
$stateStoreWritable<TRouterState>src/routerProvider.ts:968
$stateHashStore<{ current: Partial<TUrlProps>; depth: number; history: TUrlProps[]; location: TUrlProps; prev: Partial<TUrlProps>; }>src/routerProvider.ts:969
$trasitionStateStoreWritable<TRouterState>src/routerProvider.ts:966
$trasitionStateHashStore<{ depth: number; history: TUrlProps[]; location: Partial<TUrlProps>; prev: Partial<TUrlProps>; }>src/routerProvider.ts:967
backLocation()(...args) => Promise<any>src/routerProvider.ts:1021
backLocationThrottled()(...args) => Promise<void>src/routerProvider.ts:1065
backRepeat()(count, options?) => Promise<any>src/routerProvider.ts:1023
backToDepth()(...args) => Promise<any>src/routerProvider.ts:1022
backToStart()(options?) => Promise<any>src/routerProvider.ts:1024
getCurrentHashLocation()() => Partial<TUrlProps>src/routerProvider.ts:1006
getCurrentLocation()() => TUrlPropssrc/routerProvider.ts:1005
getFromHashLocation()() => Partial<TUrlProps>src/routerProvider.ts:1012
getFromLocation()() => TUrlPropssrc/routerProvider.ts:1009
getHistory()() => TUrlProps[]src/routerProvider.ts:1004
getNextHashLocation()() => Partial<TUrlProps>src/routerProvider.ts:1011
getNextLocation()() => TUrlPropssrc/routerProvider.ts:1008
getPrevHashLocation()() => anysrc/routerProvider.ts:1010
getPrevLocation()() => anysrc/routerProvider.ts:1007
HashLinkElementType<any, keyof IntrinsicElements>src/routerProvider.ts:1002
HashNavLinkElementType<any, keyof IntrinsicElements>src/routerProvider.ts:1003
hashParamReplaceStorage{ clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; get: (key) => any; getKeys: () => string[]; remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; watch: (watcher) => Unsubscribe; }src/routerProvider.ts:999
hashParamReplaceStorage.clear()() => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:896
hashParamReplaceStorage.get()(key) => anysrc/routerProvider.ts:893
hashParamReplaceStorage.getKeys()() => string[]src/routerProvider.ts:895
hashParamReplaceStorage.remove()(key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:894
hashParamReplaceStorage.set()(key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:892
hashParamReplaceStorage.watch()(watcher) => Unsubscribesrc/routerProvider.ts:900
hashParamStorage{ clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; get: (key) => any; getKeys: () => string[]; remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; watch: (watcher) => Unsubscribe; }src/routerProvider.ts:997
hashParamStorage.clear()() => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:896
hashParamStorage.get()(key) => anysrc/routerProvider.ts:893
hashParamStorage.getKeys()() => string[]src/routerProvider.ts:895
hashParamStorage.remove()(key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:894
hashParamStorage.set()(key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:892
hashParamStorage.watch()(watcher) => Unsubscribesrc/routerProvider.ts:900
isTryClosingCurrentLocation()() => booleansrc/routerProvider.ts:1027
isTryClosingLocation()(depth) => booleansrc/routerProvider.ts:1025
isWaitingUnloadCurrentLocation()() => booleansrc/routerProvider.ts:1028
isWaitingUnloadLocation()(depth) => booleansrc/routerProvider.ts:1026
LinkElementType<any, keyof IntrinsicElements>src/routerProvider.ts:1000
LinkProvider()(__namedParameters) => ElementTypesrc/routerProvider.ts:991
NavLinkElementType<any, keyof IntrinsicElements>src/routerProvider.ts:1001
onBeforeUnload()(callback, options?) => () => voidsrc/routerProvider.ts:1029
paramReplaceStorage{ clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; get: (key) => any; getKeys: () => string[]; remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; watch: (watcher) => Unsubscribe; }src/routerProvider.ts:998
paramReplaceStorage.clear()() => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:896
paramReplaceStorage.get()(key) => anysrc/routerProvider.ts:893
paramReplaceStorage.getKeys()() => string[]src/routerProvider.ts:895
paramReplaceStorage.remove()(key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:894
paramReplaceStorage.set()(key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:892
paramReplaceStorage.watch()(watcher) => Unsubscribesrc/routerProvider.ts:900
paramStorage{ clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; get: (key) => any; getKeys: () => string[]; remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; watch: (watcher) => Unsubscribe; }src/routerProvider.ts:996
paramStorage.clear()() => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:896
paramStorage.get()(key) => anysrc/routerProvider.ts:893
paramStorage.getKeys()() => string[]src/routerProvider.ts:895
paramStorage.remove()(key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:894
paramStorage.set()(key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }src/routerProvider.ts:892
paramStorage.watch()(watcher) => Unsubscribesrc/routerProvider.ts:900
paramStorageProvider()($query, pushLocation) => { clear: () => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; get: (key) => any; getKeys: () => string[]; remove: (key) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; set: (key, v?) => { set: (key: string, v?: any) => ...; get: (key: string) => any; remove: (key: string) => ...; getKeys: () => string[]; clear: () => ...; watch: (watcher: (state: Record<string, any>) => any) => Unsubscribe; }; watch: (watcher) => Unsubscribe; }src/routerProvider.ts:993
pushHashLocation()(child, options?) => Promise<any>src/routerProvider.ts:1015
pushLocation()(extendsLocation, options?) => Promise<any>src/routerProvider.ts:1013
pushLocationThrottled()(...args) => Promise<void>src/routerProvider.ts:1063
pushParam()(query) => Promise<any>src/routerProvider.ts:1057
replaceHashLocation()(child, options?) => Promise<any>src/routerProvider.ts:1016
replaceLocation()(extendsLocation, options?) => Promise<any>src/routerProvider.ts:1014
replaceLocationThrottled()(...args) => Promise<void>src/routerProvider.ts:1064
replaceParam()(query) => Promise<any>src/routerProvider.ts:1060
routerByHashLocationProvider()<T>(routes, notFoundHandler?) => Store<T & { index: number; params: TParams; } & TRouterState & Record<string, any>>src/routerProvider.ts:995
routerByLocationProvider()<T>(routes, notFoundHandler?) => Store<T & { index: number; params: TParams; } & TRouterState & Record<string, any>>src/routerProvider.ts:994
routerForObservableMapProvider()<T>(_routes, notFoundHandler?) => (state) => T & { index: number; params: TParams; } & TRouterState & Record<string, any>src/routerProvider.ts:992
storagePushHashLocation()(child, options?) => Promise<any>src/routerProvider.ts:1018
storagePushLocation()(extendsLocation, options?) => Promise<any>src/routerProvider.ts:1017
storageReplaceHashLocation()(child, options?) => Promise<any>src/routerProvider.ts:1020
storageReplaceLocation()(extendsLocation, options?) => Promise<any>src/routerProvider.ts:1019
useRouteIsFocus()(effect, deps?) => voidsrc/routerProvider.ts:1031

runFrame()

ts
function runFrame(callback, interval?): () => void;

Defined in: src/browser/runFrame.ts:14

Runs callback on each animation frame and accumulates elapsed time until interval ms is reached, then calls callback(balance) and resets the balance.

Parameters

ParameterTypeDefault valueDescription
callback(delta) => voidundefinedFunction called with the accumulated time delta in ms.
intervalnumber0Minimum interval between calls in ms (default: 0, every frame).

Returns

A function that stops the animation loop.

() => void

Example

ts
const stop = runFrame((delta) => console.log(delta), 100);
stop(); // stops the loop

wsAsyncRequestProvider()

ts
function wsAsyncRequestProvider<TResponse>(wsUrl, configs?): any;

Defined in: src/browser/wsAsyncRequestProvider.ts:52

Provides an async WebSocket request API over a single connection. Internally queues requests until the socket is connected and resolves promises when corresponding responses arrive, matched by idempotency key.

Type Parameters

Type ParameterDefault type
TResponseany

Parameters

ParameterTypeDescription
wsUrlstringWebSocket URL.
configs?IWsAsyncConfigsOptional configuration (reconnect, handlers).

Returns

any

An async request(method, data) function with .close() and .reset() methods.

Example

ts
const request = wsAsyncRequestProvider('wss://example.com/ws');
const response = await request('getUser', { id: 1 });

wsConnect()

ts
function wsConnect(wsUrl): Promise<WebSocket>;

Defined in: src/browser/wsConnect.ts:13

Creates a WebSocket connection and resolves with the opened socket.

Parameters

ParameterTypeDescription
wsUrlstringWebSocket URL (ws:// or wss://).

Returns

Promise<WebSocket>

Promise resolved with the opened WebSocket instance.

Example

ts
const socket = await wsConnect('wss://example.com/ws');

wsSeriesRequestProvider()

ts
function wsSeriesRequestProvider<TResponse>(wsUrl, configs?): (method, data?) => Promise<TResponse>;

Defined in: src/browser/wsSeriesRequestProvider.ts:33

Provides a simple sequential WebSocket request API over a single connection. Requests are executed one-by-one: the next request is sent only after the previous response is received.

Type Parameters

Type ParameterDefault type
TResponseany

Parameters

ParameterTypeDescription
wsUrlstringWebSocket URL.
configs?IWsSeriesConfigsOptional configuration (error/message/reconnect handlers).

Returns

An async request(method, data) function.

(method, data?) => Promise<TResponse>

Example

ts
const request = wsSeriesRequestProvider('wss://example.com/ws');
const response = await request('getUser', { id: 1 });

References

cookieStorageProvider

Re-exports cookieStorageProvider


getViewportSizeProvider

Re-exports getViewportSizeProvider


localStorageProvider

Re-exports localStorageProvider


readyProvider

Re-exports readyProvider


setStyleSheet

Re-exports setStyleSheet


storageInit

Re-exports storageInit


stylesRenderProvider

Re-exports stylesRenderProvider


TCookieStorage

Re-exports TCookieStorage


TCookieWindowContext

Re-exports TCookieWindowContext


TLocalStorage

Re-exports TLocalStorage


TLocalStorageEvent

Re-exports TLocalStorageEvent


TLocalStorageWindowContext

Re-exports TLocalStorageWindowContext


TParams

Re-exports TParams


TReadyDocumentContext

Re-exports TReadyDocumentContext


TReadyFn

Re-exports TReadyFn


TReadyUnsubscribe

Re-exports TReadyUnsubscribe


TReadyWindowContext

Re-exports TReadyWindowContext


TRouteMapper

Re-exports TRouteMapper


TSetStyleSheetDocument

Re-exports TSetStyleSheetDocument


TStyleItem

Re-exports TStyleItem


TStylesRenderDocument

Re-exports TStylesRenderDocument


TUrlProps

Re-exports TUrlProps


TViewportWindowContext

Re-exports TViewportWindowContext

MIT License