navigation

A minimalistic Navigation library for Apple TV applications
Author:
Source:

Members

(static) activeDocument

Returns the current active document presented on the UI. Note: This is just a wrapper to the TVMLKit JS getActiveDocument method.
Source:

(static) currentDocument

Returns the topmost document from the navigation stack.
Source:

Methods

(static) back()

Goes back in history.
Source:

(static) clear()

Clears the navigation stack.
Source:

(static) dismissModal()

Dismisses the current modal window.
Source:

(static) getErrorDoc(message) → {Document}

Get an error document.
Source:
Parameters:
Name Type Description
message Object | String Error page configuration or error message
Returns:
Type:
Document
A newly created error document

(static) getLoaderDoc(message) → {Document}

Get a loader document.
Source:
Parameters:
Name Type Description
message String Loading message
Returns:
Type:
Document
A newly created loader document

(static) navigate(page, options, replace) → {Promise}

Navigates to the provided page if it exists in the list of available pages.
Source:
Parameters:
Name Type Description
page String Name of the previously created page.
options Object The options that will be passed on to the page during runtime.
replace Boolean Replace the previous page.
Returns:
Type:
Promise
Returns a Promise that resolves upon successful navigation.

(static) navigateToMenuPage() → {Promise}

Navigates to the menu page if it exists
Source:
Returns:
Type:
Promise
Returns a Promise that resolves upon successful navigation.

(static) pop(docopt)

Pops the recent document or pops all document before the provided document.
Source:
Parameters:
Name Type Attributes Description
doc Document <optional>
The document until which we need to pop.

(static) presentModal(modal) → {Document}

Shows a modal. Closes the previous modal before showing a new modal.
Source:
Parameters:
Name Type Description
modal Document | String | Object The TVML string/document representation of the modal window or a configuration object to create modal from
Returns:
Type:
Document
The created modal document

(static) removeActiveDocument()

Removes the current active document from the stack.
Source:

(static) replaceDocument(doc, docToReplace)

Replaces a document on the navigation stack with the provided new document. Also adds the page level default handlers to the new document and removes the existing handlers from the document that is to be replaced.
Source:
Parameters:
Name Type Description
doc Document The document to push
docToReplace Document The document to replace

(static) setOptions(cfg)

Sets the default options for navigation.
Source:
Parameters:
Name Type Description
cfg Object The configuration object {defaults}

(static) showError(cfg) → {Document}

Shows the error page using the existing error template. Also applies any default handlers and caches the document for later use.
Source:
Parameters:
Name Type Description
cfg Object | function | Boolean The configuration options or the template function or boolean to hide the error
Returns:
Type:
Document
The created error document.

(static) showLoading(cfg) → {Document}

Shows a loading page if a loader template exists. Also applies any default handlers and caches the document for later use.
Source:
Parameters:
Name Type Description
cfg Object | function The configuration options or the template function
Returns:
Type:
Document
The created loader document.