Namespace: Controller

Controller

Members

(static) ..observedAttributes :Array.<String>

These are the attributes to watch for and react to changes
This is handled by attributeChangedCallback()
The default implementation will call set{AttributeName}(oldValue, newValue)

Type:
  • Array.<String>
Source:

Methods

debug(obj)

Helper debug function
Only enabled when

  • window.__BINDER_DEBUG__ is set to true
  • window.__BINDER_DEBUG__ is an array on this controllers localName is present
Parameters:
Name Type Description
obj Object

The data to log

Source:

disconnectedCallback()

Runs when the element in removed from the DOM

Source:

#emit(eventName, detail, config)

Emit a new event from this controller

Parameters:
Name Type Description
eventName string

The name of the event, automatically prefixed with ${this.localName}:

detail object

Optional object that is passed in the event under the key detail

config object

Optional configuration object that can be passed to new CustomEvent()

Source:

handleShadow()

Work in progress
If the element has a <template> with a :use-shadow attribute, it will be used to create a shadow root
When using the shadow DOM the bind() call fails

Source:

(static) .attributeChangedCallback(name, oldValue, newValue)

The default implementation of attributeChangedCallback
See: https://developers.google.com/web/fundamentals/web-components/customelements#attrchanges
We will convert the attribute name to camel case, strip out the leading data- or aria- parts and call set{AttributeName}(oldValue, newValue) (if it exists)
Eg. A change to data-disabled will call setDisabled(oldValue, newValue)

Parameters:
Name Type Description
name string

The name of the attribute that changed

oldValue string

The old value of the attribute

newValue string

The new value of the attribute

Source:

(static) .bind()

Initializes the controller instance
Can be called manaually when the child elements change to force refreshing the controller state
eg. re-attach events etc...

Source:

(static) .connectCallback()

Source:

(static) .init(args)

Called during the connectedCallback() (when an element is created in the DOM)
Expected to be overridden

Parameters:
Name Type Description
args *
Source:

(static) .listenFor(target, eventName, callback)

Listens for an event to be fired from a child element

Parameters:
Name Type Description
target Element

The element to listen for events from, use window to listen for global events

eventName string

The name of the event to listen for

callback function

The callback to call when the event is fired

Source:

(static) .render(rootNode)

Re-renders everything with the :render attribute

Parameters:
Name Type Description
rootNode Element

The root node to search from

Source:

(static) .setAutoRender(interval)

Sets an interval to auto call this.render()
Overwrites previously set render intervals

Parameters:
Name Type Description
interval *

Duration in milliseconds

Source: