Upravit

Sdílet prostřednictvím


IHostNavigationService interface

Service for interacting with the host window's navigation (URLs, new windows, etc.)

Methods

getHash()

Gets the current hash.

getPageNavigationElements()

Gets the set of navigation elements (like hubs and hub groups) selected on the current page.

getPageRoute()

Gets information about the route that was matched for the current page

getQueryParams()

Gets the current set of query parameters in the host page's URL.

navigate(string)

Navigate the parent page to the specified url

onHashChanged((hash: string) => void)

Add a callback to be invoked each time the hash navigation has changed

openNewWindow(string, string)

Open a new window to the specified url

reload()

Reloads the parent frame

replaceHash(string)

Replace existing hash with the provided hash from the hosted content.

setDocumentTitle(string)

Update the host document's title (appears as the browser tab title).

setHash(string)

Sets the provided hash from the hosted content.

setQueryParams({[key: string]: string})

Sets one or more query parameters on the host page

Method Details

getHash()

Gets the current hash.

function getHash(): Promise<string>

Returns

Promise<string>

getPageNavigationElements()

Gets the set of navigation elements (like hubs and hub groups) selected on the current page.

function getPageNavigationElements(): Promise<INavigationElement[]>

Returns

Promise<INavigationElement[]>

getPageRoute()

Gets information about the route that was matched for the current page

function getPageRoute(): Promise<IPageRoute>

Returns

Promise<IPageRoute>

getQueryParams()

Gets the current set of query parameters in the host page's URL.

function getQueryParams(): Promise<{[key: string]: string}>

Returns

Promise<{[key: string]: string}>

navigate(string)

Navigate the parent page to the specified url

function navigate(url: string)

Parameters

url

string

Url to navigate to

onHashChanged((hash: string) => void)

Add a callback to be invoked each time the hash navigation has changed

function onHashChanged(callback: (hash: string) => void)

Parameters

callback

(hash: string) => void

Method invoked on each navigation hash change

openNewWindow(string, string)

Open a new window to the specified url

function openNewWindow(url: string, features: string)

Parameters

url

string

Url of the new window

features

string

Comma-separated list of features/specs sent as the 3rd parameter to window.open. For example: "height=400,width=400".

reload()

Reloads the parent frame

function reload()

replaceHash(string)

Replace existing hash with the provided hash from the hosted content.

function replaceHash(hash: string)

Parameters

hash

string

setDocumentTitle(string)

Update the host document's title (appears as the browser tab title).

function setDocumentTitle(title: string)

Parameters

title

string

The new title of the window

setHash(string)

Sets the provided hash from the hosted content.

function setHash(hash: string)

Parameters

hash

string

setQueryParams({[key: string]: string})

Sets one or more query parameters on the host page

function setQueryParams(parameters: {[key: string]: string})

Parameters

parameters

{[key: string]: string}

Dictionary of query string parameters to add, update, or remove (pass an empty value to remove)