Home Identifier Source Repository
public class | source

AttributeBuilder

Extends:

BuilderPropertyBuilder → AttributeBuilder

The attribute builder. Its goal is to provide a way to define an attribute.

Constructor Summary

Public Constructor
public

constructor(attrName: string)

Method Summary

Public Methods
public

To handle the attribute/property value as a boolean:

public

build(proto: *, on: *)

public

To override the property name.

Inherited Summary

From class Builder
public

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

To specify the logic of the builder.

From class PropertyBuilder
public

getter(fn: function(el: HTMLElement): *): PropertyBuilder

To set a getter function.

public

To hide the property name when using Object.keys().

public

To make an immutable property.

public

setter(fn: function(el: HTMLElement, value: *)): PropertyBuilder

To set a setter function.

public

value(value: *): PropertyBuilder

To set a default value.

Public Constructors

public constructor(attrName: string) source

Override:

PropertyBuilder#constructor

Params:

NameTypeAttributeDescription
attrName string
  • nullable: false

the name of the attribute

Public Methods

public boolean(): AttributeBuilder source

To handle the attribute/property value as a boolean: Attribute is present when true and missing when false.

Return:

AttributeBuilder

the builder

public build(proto: *, on: *) source

Override:

Builder#build

Params:

NameTypeAttributeDescription
proto *
on *

public property(propName: string): AttributeBuilder source

To override the property name.

Params:

NameTypeAttributeDescription
propName string
  • nullable: false

the property name