Interface IOptions<T, U>

The options object used to initialize an attached property.

Type Parameters

  • T

  • U

Hierarchy

  • IOptions

Properties

changed?: ((owner, oldValue, newValue) => void)

Type declaration

    • (owner, oldValue, newValue): void
    • A function called when the property value has changed.

      Notes

      This will be invoked when the property value is changed and the comparator indicates that the old value is not equal to the new value.

      This will not be called for the initial default value.

      Parameters

      • owner: T
      • oldValue: U
      • newValue: U

      Returns void

coerce?: ((owner, value) => U)

Type declaration

    • (owner, value): U
    • A function used to coerce a supplied value into the final value.

      Notes

      This will be called whenever the property value is changed, or when the property is explicitly coerced. The return value will be used as the final value of the property.

      This will not be called for the initial default value.

      Parameters

      • owner: T
      • value: U

      Returns U

compare?: ((oldValue, newValue) => boolean)

Type declaration

    • (oldValue, newValue): boolean
    • A function used to compare two values for equality.

      Notes

      This is called to determine if the property value has changed. It should return true if the given values are equivalent, or false if they are different.

      If this is not provided, it defaults to the === operator.

      Parameters

      • oldValue: U
      • newValue: U

      Returns boolean

create: ((owner) => U)

Type declaration

    • (owner): U
    • A factory function used to create the default property value.

      Notes

      This will be called whenever the property value is required, but has not yet been set for a given owner.

      Parameters

      • owner: T

      Returns U

name: string

The human readable name for the property.

Notes

By convention, this should be the same as the name used to define the public accessor for the property value.

This does not have an effect on the property lookup behavior. Multiple properties may share the same name without conflict.

Generated using TypeDoc