Home Identifier Source Repository
public class | source

OnBuilder

Extends:

Builder → OnBuilder

The on builder. Its goal is to provide a way to listen events coming from the custom element.

Constructor Summary

Public Constructor
public

constructor(events: string)

Method Summary

Public Methods
public

To attach the event on the capture phase insteadof of on the bubble phase.

public

delegate(selector: string): OnBuilder

To delegate the event.

public

invoke(fn: function(el: HTMLElement, evt: DOMEvent, target: HTMLElement)): OnBuilder

To do something when events occurred.

public

To prevent the default behavior.

public

To prevent the default behavior and to stop the event propagation.

public

To stop the event propagation.

Inherited Summary

From class Builder
public

build(proto: CustomElementBuilder.context.proto, on: on)

To specify the logic of the builder.

Public Constructors

public constructor(events: string) source

Params:

NameTypeAttributeDescription
events string
  • nullable: false

a list of tuple 'event target' separated by comas, the target is optional

Public Methods

public capture(): OnBuilder source

To attach the event on the capture phase insteadof of on the bubble phase.

Return:

OnBuilder

the builder

public delegate(selector: string): OnBuilder source

To delegate the event.

Params:

NameTypeAttributeDescription
selector string
  • nullable: false

the selector

Return:

OnBuilder

the builder

public invoke(fn: function(el: HTMLElement, evt: DOMEvent, target: HTMLElement)): OnBuilder source

To do something when events occurred. The target argument is by default the custom element. When the delegate feature is used, target is the matched element.

Params:

NameTypeAttributeDescription
fn function(el: HTMLElement, evt: DOMEvent, target: HTMLElement)
  • nullable: false

the event's logic

Return:

OnBuilder

the builder

public prevent(): OnBuilder source

To prevent the default behavior.

Return:

OnBuilder

the builder

public skip(): OnBuilder source

To prevent the default behavior and to stop the event propagation.

Return:

OnBuilder

the builder

public stop(): OnBuilder source

To stop the event propagation.

Return:

OnBuilder

the builder