Home Reference Source
import NavigationTemplate from '~/template/NavigationTemplate.js'
public class | source

NavigationTemplate

Extends:

Template → NavigationTemplate

Navigation template for friendly nav.

Static Method Summary

Static Public Methods
public static

Creates a nav from an object

Constructor Summary

Public Constructor
public

constructor(nav: Array<Array<string, string>>, opts: Object, firstItem: Arraystring, ?string>)

Takes dyadic-tuple in form of array.

Method Summary

Public Methods
public

Called on didLoad

public

observeNavigation(): BehaviorSubject<Array<string, string>>

Returns navigation subject.

Inherited Summary

From class Template
public static get

An empty template

public static

Performs a move TemplateType for a given HTML id to return a template based on the id's root.

public static

fromInnerHTML(wrapper: HTMLElement, innerHTML: string, type: TemplateType): Template

From innerHTML will wrap in div

public static

Creates template <div> with text.

public get

underlyingNode: HTMLElement

Returns the underlying element

public

defineLinkedClass(name: string, className: string, node: HTMLElement)

Defines a linked class

public

defineLinkedInput(name: string, input: HTMLElement)

Defines a linked input

public

defineLinkedText(name: string, defaultValue: string): Text

Creates a field w/ updating text

public abstract

async didInitialLoad()

Called when loaded the first time

public abstract

Called when the view has loaded

public

Called when disappeared

public

getParent(defaultElement: HTMLElement): HTMLElement

Gets the original parent or else a default

public

loadBeforeContext(elem: HTMLElement): HTMLElement

Loads before an element

public

loadInContext(parent: HTMLElement, allowDupliacte: boolean): HTMLElement

Loads the template in a context

public

loadReplacingContext(source: HTMLElement): HTMLElement

Loads and replaces

public

prependInContext(parent: HTMLElement, allowDupliacte: boolean): HTMLElement

Prepends the template in a context

public

Removes from the context.

public

unique(): HTMLElement

Returns a unique instance of the template as an HTMLElement.

public

async willInitialLoad()

Called before loaded the first time

public

Called right before the view will appear on screen

public

Called before disappearing

Static Public Methods

public static navFromObject(object: Object): Array<Array<string, string>> source

Creates a nav from an object

Params:

NameTypeAttributeDescription
object Object

Return:

Array<Array<string, string>>

Public Constructors

public constructor(nav: Array<Array<string, string>>, opts: Object, firstItem: Arraystring, ?string>) source

Takes dyadic-tuple in form of array. Followed by elements and if the second element is href, this is used when emitting clicks.

Override:

Template#constructor

Params:

NameTypeAttributeDescription
nav Array<Array<string, string>>

Navigation data

opts Object

initialization options

firstItem Arraystring, ?string>
  • nullable: true

Array in form of section name and item name.

Public Methods

public didLoad() source

Called on didLoad

Override:

Template#didLoad

public observeNavigation(): BehaviorSubject<Array<string, string>> source

Returns navigation subject. Emits non-duplicates in form of like [section, item].

Return:

BehaviorSubject<Array<string, string>>