ModuleSignature

ModuleSignature

Class representing ModuleSignature

Constructor

new ModuleSignature(name, selector)

Source:

creates new ModuleSignature object

Parameters:
Name Type Default Description
name string

Module name

selector string | null null

Methods

addDependency(key, module) → {ModuleSignature}

Source:

add dependencies

Parameters:
Name Type Description
key string
module function
Returns:
Type
ModuleSignature

addElementSignature(elementSignature) → {ModuleSignature}

Source:

add element signature

Parameters:
Name Type Description
elementSignature ElementSignature
Returns:
Type
ModuleSignature

disableLazy() → {ModuleSignature}

Source:

loads this module at the start and does not wait until the intersection observer found the element

Returns:
Type
ModuleSignature

getElementSignatures() → {Set}

Source:

get elements signatures

Returns:
  • set of ElementSignature
Type
Set

getImportController() → {function|null}

Source:

get controller import method

Returns:
Type
function | null

getImportStyles() → {function|null}

Source:

get styles import method

Returns:
Type
function | null

getSelector() → {string|null}

Source:

get defined selector

Returns:
Type
string | null

setImportController(controller) → {AbstractController}

Source:

set controller import

Example
new ModuleSignature('example')
 .setImportController(() => import('./example.controller'));
Parameters:
Name Type Default Description
controller function null
Returns:
Type
AbstractController

setImportStyles(styles) → {ModuleSignature}

Source:

set styles import

Parameters:
Name Type Default Description
styles function null
Returns:
Type
ModuleSignature

setSelector(selector) → {ModuleSignature}

Source:

set controller selector

Example
new ModuleSignature('example').setSelector('.example-class-selector')
Parameters:
Name Type Default Description
selector string null

selector for document.querySelectorAll()

Returns:
Type
ModuleSignature

validateController(controller) → {boolean}

Source:

validate given controller

Parameters:
Name Type Description
controller
Returns:
Type
boolean

validateImportStyles(styles) → {boolean}

Source:

validate given import styles

Parameters:
Name Type Description
styles
Returns:
Type
boolean

validateName() → {boolean}

Source:

validate given name for module signature

Returns:
Type
boolean

validateSelector(selector) → {boolean}

Source:

validate given selector

Parameters:
Name Type Description
selector
Returns:
Type
boolean