Options
All
  • Public
  • Public/Protected
  • All
Menu

Defines options for a property accessor.

Type parameters

  • T

Hierarchy

  • PropertyDeclaration

Index

Properties

Methods

Properties

Optional attribute

attribute: boolean | string

Indicates how and whether the property becomes an observed attribute. If the value is false, the property is not added to observedAttributes. If true or absent, the lowercased property name is observed (e.g. fooBar becomes foobar). If a string, the string value is observed (e.g attribute: 'foo-bar').

Optional reflect

reflect: undefined | false | true

Indicates if the property should reflect to an attribute. If true, when the property is set, the attribute is set using the attribute name determined according to the rules for the attribute property option and the value of the property serialized using the rules from the type property option.

Optional type

type: AttributeType<T>

Indicates how to serialize and deserialize the attribute to/from a property. If this value is a function, it is used to deserialize the attribute value a the property value. If it's an object, it can have keys for fromAttribute and toAttribute where fromAttribute is the deserialize function and toAttribute is a serialize function used to set the property to an attribute. If no toAttribute function is provided and reflect is set to true, the property value is set directly to the attribute.

Methods

Optional hasChanged

  • hasChanged(value: T, oldValue: T): boolean
  • A function that indicates if a property should be considered changed when it is set. The function should take the newValue and oldValue and return true if an update should be requested.

    Parameters

    • value: T
    • oldValue: T

    Returns boolean

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc