Template source

Specializes Montage

Properties

expandParameters source

instantiateWithInstances source

setObjectMetadata source

Add metadata to specific objects of the serialization.

Methods

callDelegateMethod(name) source

This method calls the method named with the identifier prefix if it exists. Example: If the name parameter is "shouldDoSomething" and the caller's identifier is "bob", then this method will try and call "bobShouldDoSomething"

Parameters:
Name Type Description
name string
Inherited From:

equals(anObject) → {boolean} source

Returns true if two objects are equal, otherwise returns false.

Parameters:
Name Type Description
anObject Object

The object to compare for equality.

Inherited From:
Returns: boolean

Returns true if the calling object and anObject are identical and their uuid properties are also equal. Otherwise, returns false.

getExternalObjectsString(doc) → {Promise} source

Searches for an external objects file in a document and returns its contents if found.

Parameters:
Name Type Description
doc string

The document to search.

Returns: Promise

A promise to the contents of the objects file or null if none found.

getInlineObjectsString(doc) → {String|null} source

Searches for an inline objects string in a document and returns it if found.

Parameters:
Name Type Description
doc HTMLDocument

The document with the objects string.

Returns: String | null

The objects string or null if not found.

getObjectsString(doc) → {Promise} source

Searches for objects in the document. The objects string can live as an inline script in the document or as an external resource that needs to be loaded.

Parameters:
Name Type Description
doc HTMLDocument

The document with the objects string.

Returns: Promise

A promise for the objects string, null if not found.

initWithDocument(_document, _require) → {Promise} source

Initializes the Template with a document.

Parameters:
Name Type Description
_document HTMLDocument

The document to be used as a template.

_require require

The require function used to load modules when a template is instantiated.

Returns: Promise

A promise for the proper initialization of the template.

initWithHtml(html, _require) → {Promise} source

Initializes the Template with an HTML string.

Parameters:
Name Type Description
html HTMLDocument

The HTML string to be used as a template.

_require require

The require function used to load modules when a template is instantiated.

Returns: Promise

A promise for the proper initialization of the template.

initWithModuleId(moduleId, _require) → {Promise} source

Initializes the Template with the HTML document at the module id.

Parameters:
Name Type Description
moduleId string

The module id of the HTML page to load.

_require require

The require function used to load modules when a template is instantiated.

Returns: Promise

A promise for the proper initialization of the template.

initWithObjectsAndDocumentFragment(objects, html, _require) → {Promise} source

Initializes the Template with Objects and a DocumentFragment to be used as the body of the document.

Parameters:
Name Type Description
objects Object

A JSON'able representation of the objects of the template.

html DocumentFragment

The HTML string to be used as the body.

_require require

The require function used to load modules when a template is instantiated.

Returns: Promise

A promise for the proper initialization of the template.

initWithRequire(_require) source

Initializes the Template with an empty document.

Parameters:
Name Type Description
_require require

The require function used to load modules when a template is instantiated.

setDocument(doc) → {Promise} source

Uses the document markup as the base of the template markup.

Parameters:
Name Type Description
doc HTMLDocument

The document.

Returns: Promise

A promise for the proper initialization of the document.

setInstances(instances) source

Sets the instances to use when instantiating the objects of the template. These instances will always be used when instantiating the template unless a different set of instances is passed in instantiateWithInstances().

Parameters:
Name Type Description
instances Object

The objects' instances.

Generated from a4679af

comments powered by Disqus

More help?

Can't find what you are looking for? Get in touch, we're more than happy in helping answer your questions.