Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IOptions<T, U>

The options object used to initialize an attached property.

Type parameters

  • T

  • U

Hierarchy

  • IOptions

Index

Properties

Optional changed

changed: function

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.

Type declaration

    • (owner: T, oldValue: U, newValue: U): void
    • Parameters

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

      Returns void

Optional coerce

coerce: function

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.

Type declaration

    • (owner: T, value: U): U
    • Parameters

      • owner: T
      • value: U

      Returns U

Optional compare

compare: function

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.

Type declaration

    • (oldValue: U, newValue: U): boolean
    • Parameters

      • oldValue: U
      • newValue: U

      Returns boolean

create

create: function

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.

Type declaration

    • (owner: T): U
    • Parameters

      • owner: T

      Returns U

name

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