Template
Direct Subclass:
Indirect Subclass:
Manages a section of HTML used with a view. See TemplateType to see how you can import one
Static Member Summary
Static Public Members | ||
public static get |
An empty template |
Static Method Summary
Static Public Methods | ||
public static |
fromId(id: string, type: TemplateType): Template Performs a |
|
public static |
fromInnerHTML(wrapper: HTMLElement, innerHTML: string, type: TemplateType): Template From innerHTML will wrap in div |
|
public static |
fromText(text: string, type: TemplateType): Template Creates template |
Constructor Summary
Public Constructor | ||
public |
constructor(root: HTMLElement, type: TemplateType) Creates a template from some form of HTML fragment. |
Member Summary
Public Members | ||
public get |
underlyingNode: HTMLElement Returns the underlying element |
Method Summary
Public Methods | ||
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 |
didLoad() 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 |
willLoad() Called right before the view will appear on screen |
|
public |
Called before disappearing |
Static Public Members
Static Public Methods
public static fromId(id: string, type: TemplateType): Template source
Performs a move
TemplateType for a given HTML id to return a
template based on the id's root.
Params:
Name | Type | Attribute | Description |
id | string | HTML ID of a HTMLElement |
|
type | TemplateType | Type of the template |
public static fromInnerHTML(wrapper: HTMLElement, innerHTML: string, type: TemplateType): Template source
From innerHTML will wrap in div
Params:
Name | Type | Attribute | Description |
wrapper | HTMLElement | ||
innerHTML | string | the innerHTML |
|
type | TemplateType |
|
public static fromText(text: string, type: TemplateType): Template source
Creates template <div>
with text.
Params:
Name | Type | Attribute | Description |
text | string | text of new elem |
|
type | TemplateType |
|
Type of the generated template. |
Public Constructors
public constructor(root: HTMLElement, type: TemplateType) source
Creates a template from some form of HTML fragment. This can be from the DOM or a JS-based HTMLElement
Params:
Name | Type | Attribute | Description |
root | HTMLElement | Root view of the template |
|
type | TemplateType |
|
Type of the template to reference. |
Public Members
Public Methods
public defineLinkedClass(name: string, className: string, node: HTMLElement) source
Defines a linked class
public defineLinkedInput(name: string, input: HTMLElement) source
Defines a linked input
Params:
Name | Type | Attribute | Description |
name | string | the name |
|
input | HTMLElement |
|
public defineLinkedText(name: string, defaultValue: string): Text source
Creates a field w/ updating text
Return:
Text |
public getParent(defaultElement: HTMLElement): HTMLElement source
Gets the original parent or else a default
Params:
Name | Type | Attribute | Description |
defaultElement | HTMLElement |
|
Return:
HTMLElement | parent element or the |
public loadBeforeContext(elem: HTMLElement): HTMLElement source
Loads before an element
Params:
Name | Type | Attribute | Description |
elem | HTMLElement | Element to load before |
Return:
HTMLElement | rendered element |
public loadInContext(parent: HTMLElement, allowDupliacte: boolean): HTMLElement source
Loads the template in a context
Params:
Name | Type | Attribute | Description |
parent | HTMLElement | Will be appended to this node. |
|
allowDupliacte | boolean | If should allow to be loaded multiple times |
Return:
HTMLElement | rendered element |
public loadReplacingContext(source: HTMLElement): HTMLElement source
Loads and replaces
Params:
Name | Type | Attribute | Description |
source | HTMLElement | what to replace |
Return:
HTMLElement |
public prependInContext(parent: HTMLElement, allowDupliacte: boolean): HTMLElement source
Prepends the template in a context
Params:
Name | Type | Attribute | Description |
parent | HTMLElement | Will be appended to this node. |
|
allowDupliacte | boolean | If should allow to be loaded multiple times |
Return:
HTMLElement | rendered element |
public unique(): HTMLElement source
Returns a unique instance of the template as an HTMLElement.
Return:
HTMLElement | unique instance of the DOM element. |