ModuleLauncher

ModuleLauncher

Class representing ModuleLauncher

Constructor

new ModuleLauncher(modules, dataObserver, elementBuilder)

Source:

Creates instance of ModuleLauncher

Parameters:
Name Type Description
modules
dataObserver DataObserver
elementBuilder ElementBuilder

Methods

(private) _addAsSleeper(elements, signature)

Source:

adding an element when it appears through mutation observer

Parameters:
Name Type Description
elements array
signature ModuleSignature

(async, private) _addStyles(name, importer) → {Promise.<ModuleLauncher>}

Source:

extract and add stylesheet

Parameters:
Name Type Description
name string
importer function
Returns:
Type
Promise.<ModuleLauncher>

(private) _batchPaint()

Source:

combine styles to be added to avoid too much repainting

(async, private) _bindController(element, signature) → {Promise.<void>}

Source:

bind controllers from signatures

Parameters:
Name Type Description
element Element
signature ModuleSignature
Returns:
Type
Promise.<void>

(async, private) _bootstrap() → {Promise.<void>}

Source:

bootstrap module instance iterator

Returns:
Type
Promise.<void>

(private) _destructInstance(element)

Source:

call instance destruct

Parameters:
Name Type Description
element Element

(private) _eachModule(callback)

Source:

module iterator for each module

Parameters:
Name Type Default Description
callback function | null null

(private) _init()

Source:

initialize ModuleLoader

(async, private) _launchMatchingElements(node) → {Promise.<void>}

Source:

launch matching elements

Parameters:
Name Type Description
node Element
Returns:
Type
Promise.<void>

(private) _observeDomMutation(mutations)

Source:

add observe DOM changes

Parameters:
Name Type Description
mutations NodeList

(private) _wokeUpElements(entries, observer)

Source:

callback when intersection observer added some entries

Parameters:
Name Type Description
entries array
observer Observer

bindControllerInstance(element, controller)

Source:

bind controller instance

Parameters:
Name Type Description
element
controller

(async) getControllerFromSignature(signature) → {Promise.<null>}

Source:

get controller from signature

Parameters:
Name Type Description
signature
Returns:
Type
Promise.<null>

getIntersectionObserver() → {IntersectionObserver|null}

Source:

get intersection observer

Returns:
Type
IntersectionObserver | null

getStyleElement(name, styles) → {Element}

Source:

get style element

Parameters:
Name Type Description
name
styles
Returns:
Type
Element

registerObserver(element, options)

Source:

register observer

Parameters:
Name Type Description
element Element
options object