HistoryBridgeFunctions
Index
Methods
addBlock
Callback must be wrapped with comlink.proxy by FrameWrapper. Returns an async unsubscribe fn.
Parameters
callback: () => Promise<boolean>
optionalopts: ChaynsHistoryBlockOptions
Returns Promise<() => void>
navigate
Parameters
opts: { activeChild?: null | string; activeChildInit?: { route?: string | string[]; state?: Record<string, unknown> }; route?: string | string[]; state?: Record<string, unknown> } & ChaynsHistoryNavigationCommitOptions & { hash?: string; params?: Record<string, string> }
Returns Promise<ChaynsHistoryActionResult>
setActiveChild
Parameters
id: null | string
optionalinit: { route?: string | string[]; state?: Record<string, unknown> }
optionalroute: string | string[]
optionalstate: Record<string, unknown>
Returns Promise<ChaynsHistoryActionResult>
setHash
Parameters
hash: string
optionalopts: ChaynsHistoryNavigationCommitOptions
Returns Promise<void>
setParams
Parameters
params: Record<string, string>
optionalopts: ChaynsHistoryNavigationCommitOptions
Returns Promise<void>
setRoute
Parameters
route: string | string[]
optionalopts: ChaynsHistoryNavigateOptions
Returns Promise<void>
setSegmentCount
Parameters
n: number
Returns Promise<void>
setState
Parameters
state: Record<string, unknown>
optionalopts: ChaynsHistoryNavigateOptions
Returns Promise<void>
Async bridge functions forwarded via comlink from the iframe (FrameWrapper) to the parent window (HostIframe). All methods are async because they cross the comlink boundary.
Callbacks that cross the boundary (addBlock) must be wrapped with
comlink.proxy()by the caller (FrameWrapper.init) before being passed in.