ElementBuilder

ElementBuilder

new ElementBuilder(signatures, templateEngine, schemaValidator, options)

Source:

Create ElementBuilder instance

Parameters:
Name Type Default Description
signatures Array.<ElementSignature>
templateEngine function null
schemaValidator function null
options object

Methods

(private) _elementExists(name) → {boolean}

Source:

checks if element exists

Parameters:
Name Type Description
name ElementSignature.<name>
Returns:
Type
boolean

(private) _generateElement(name, data)

Source:

generate element instance

Parameters:
Name Type Description
name ElementSignature.<name>
data object

(async, private) _loadElementModule(name, data) → {Promise.<TResult>}

Source:

load element module

Parameters:
Name Type Description
name ElementSignature.<name>
data object
Returns:
Type
Promise.<TResult>

(private) _retryCreate(name, data) → {Promise}

Source:

retry create element loop when same element signature has to load multiple times at the same time

Parameters:
Name Type Description
name Elementsignature.<name>
data object
Returns:
Type
Promise

(private) _signatureExists(name) → {boolean}

Source:

checks if signature exists

Parameters:
Name Type Description
name ElementSignature.<name>
Returns:
Type
boolean

(private) _transformToObject(signatures) → {object}

Source:

transform signatures array to {name: signature} object

Parameters:
Name Type Description
signatures Array.<ElementSignature>
Returns:
Type
object

(private) _validate(elementName, data) → {boolean}

Source:

validate data against schema

Parameters:
Name Type Description
elementName ElementSignature.<name>
data *
Returns:
Type
boolean

addElement(name, schema, template, module) → {ElementBuilder}

Source:

adds element to registry

Parameters:
Name Type Description
name ElementSignature.<name>
schema object
template string
module ElementAbstract
Returns:
Type
ElementBuilder

(async) create(name, data) → {Promise}

Source:

loads dependency creates element by name and data

Parameters:
Name Type Description
name ElementSignature.<name>
data *
Returns:
Type
Promise

getElement(name) → {object|null}

Source:

get registered element

Parameters:
Name Type Description
name ElementSignature.<name>
Returns:
Type
object | null

getElementReadyClass() → {string|null}

Source:

get element ready class

Returns:

elementReadyClass

Type
string | null

getOptions() → {Object}

Source:

get options

Returns:
Type
Object

getSchema(name) → {object}

Source:

get schema reference

Parameters:
Name Type Description
name ElementSignature.<name>
Returns:
Type
object

getSignature(name) → {object|null}

Source:

get signature

Parameters:
Name Type Description
name ElementSignature.<name>
Returns:
Type
object | null

(private) getTemplateElement(template, data) → {Node}

Source:

get template without shadow dom support

Parameters:
Name Type Description
template string
data object
Returns:
Type
Node

getTemplateInnerHtml(template, data) → {string}

Source:

get template innter html

Parameters:
Name Type Description
template string
data object
Returns:
Type
string

isBusySignature(name) → {boolean}

Source:

checks if signature is currently loading

Parameters:
Name Type Description
name ElementSignature.<name>
Returns:
Type
boolean

removeSignature(name) → {ElementBuilder}

Source:

remove signature from registry

Parameters:
Name Type Description
name ElementSignature.<name>
Returns:
Type
ElementBuilder

setBusySignature(name) → {ElementBuilder}

Source:

sets busy flag to

Parameters:
Name Type Description
name ElementSignature.<name>
Returns:
Type
ElementBuilder

ElementBuilder

new ElementBuilder()

Source:

Class represents ElementBuilder

Methods

(private) _elementExists(name) → {boolean}

Source:

checks if element exists

Parameters:
Name Type Description
name ElementSignature.<name>
Returns:
Type
boolean

(private) _generateElement(name, data)

Source:

generate element instance

Parameters:
Name Type Description
name ElementSignature.<name>
data object

(async, private) _loadElementModule(name, data) → {Promise.<TResult>}

Source:

load element module

Parameters:
Name Type Description
name ElementSignature.<name>
data object
Returns:
Type
Promise.<TResult>

(private) _retryCreate(name, data) → {Promise}

Source:

retry create element loop when same element signature has to load multiple times at the same time

Parameters:
Name Type Description
name Elementsignature.<name>
data object
Returns:
Type
Promise

(private) _signatureExists(name) → {boolean}

Source:

checks if signature exists

Parameters:
Name Type Description
name ElementSignature.<name>
Returns:
Type
boolean

(private) _transformToObject(signatures) → {object}

Source:

transform signatures array to {name: signature} object

Parameters:
Name Type Description
signatures Array.<ElementSignature>
Returns:
Type
object

(private) _validate(elementName, data) → {boolean}

Source:

validate data against schema

Parameters:
Name Type Description
elementName ElementSignature.<name>
data *
Returns:
Type
boolean

addElement(name, schema, template, module) → {ElementBuilder}

Source:

adds element to registry

Parameters:
Name Type Description
name ElementSignature.<name>
schema object
template string
module ElementAbstract
Returns:
Type
ElementBuilder

(async) create(name, data) → {Promise}

Source:

loads dependency creates element by name and data

Parameters:
Name Type Description
name ElementSignature.<name>
data *
Returns:
Type
Promise

getElement(name) → {object|null}

Source:

get registered element

Parameters:
Name Type Description
name ElementSignature.<name>
Returns:
Type
object | null

getElementReadyClass() → {string|null}

Source:

get element ready class

Returns:

elementReadyClass

Type
string | null

getOptions() → {Object}

Source:

get options

Returns:
Type
Object

getSchema(name) → {object}

Source:

get schema reference

Parameters:
Name Type Description
name ElementSignature.<name>
Returns:
Type
object

getSignature(name) → {object|null}

Source:

get signature

Parameters:
Name Type Description
name ElementSignature.<name>
Returns:
Type
object | null

(private) getTemplateElement(template, data) → {Node}

Source:

get template without shadow dom support

Parameters:
Name Type Description
template string
data object
Returns:
Type
Node

getTemplateInnerHtml(template, data) → {string}

Source:

get template innter html

Parameters:
Name Type Description
template string
data object
Returns:
Type
string

isBusySignature(name) → {boolean}

Source:

checks if signature is currently loading

Parameters:
Name Type Description
name ElementSignature.<name>
Returns:
Type
boolean

removeSignature(name) → {ElementBuilder}

Source:

remove signature from registry

Parameters:
Name Type Description
name ElementSignature.<name>
Returns:
Type
ElementBuilder

setBusySignature(name) → {ElementBuilder}

Source:

sets busy flag to

Parameters:
Name Type Description
name ElementSignature.<name>
Returns:
Type
ElementBuilder