Namespace: utils

bb.utils

Utils can be used to control how we create components
Source:

Methods

(static) addCustomEvent(obj, eventType, eventHandler) → {object}

Adds an event handler to a componet
Parameters:
Name Type Description
obj object Target object
eventType string Name of the event
eventHandler function Event handler
Source:
Returns:
- Object with a list of defined event handlers
Type
object

(static) addFeature(obj)

Adds a feature to the component
Parameters:
Name Type Description
obj object Target object. Usually a prototype of a component. Properties "on", "define", "observedAttribute" will be stacked.
Source:

(static) defineElement(prarentClassopt, isWhat, tagopt, feature) → {function}

Define custom element in the DOM using spec v1
Parameters:
Name Type Attributes Description
prarentClass function <optional>
[HTMLElement] - Constructor or class of an element to be extended
isWhat string Name for the component. Could be used as tag name or "is" attribute
tag string <optional>
Tag name of the element. Required when extending native elements
feature object | array One or more features to have
Source:
Returns:
- Constructor of registered element
Type
function

(static) registerElement(HTMLElementopt, isWhat, tagopt, feature) → {function}

Register custom element in the DOM using spec v0
Parameters:
Name Type Attributes Description
HTMLElement function <optional>
prarentClass - Constructor or class of the element
isWhat string Name for the component. Could be used as tag name or "is" attribute
tag string <optional>
Tag name of the element. Required when extending native elements
feature object | array One or more features to have
Source:
Returns:
- Constructor of registered element
Type
function

(static) warn()

Displays warnining message in console of the browser.
Parameters:
Name Type Attributes Description
... any <optional>
One or more things to display
Source: