Namespace: Hookable

BeautifulProperties. Hookable

Namespaces

Get

Members

(static) Undefined

Source:

(static) Undefined

Source:

Methods

(static) addHook(object, key, hookType, hook, priorityopt)

Add the given hook to the property.
The order of executing hooks:Higher priority -> Lower priprity,Added earlier -> Added later.
afterGet hook could replace get value.
beforeSet hook could replace set value.
Parameters:
Name Type Attributes Description
object object
key string
hookType string beforeGet afterGet beforeSet afterSet refresh
hook BeautifulProperties.Hookable~beforeGet | BeautifulProperties.Hookable~afterGet | BeautifulProperties.Hookable~beforeSet | BeautifulProperties.Hookable~afterSet | BeautifulProperties.Hookable~refresh
priority number <optional>
1..10000.
Default value is 100.
Source:

(static) define(object, key, descriptoropt)

Parameters:
Name Type Attributes Description
object object
key string
descriptor BeautifulProperties~DataDescriptor | BeautifulProperties~AccessorDescriptor | BeautifulProperties~GenericDescriptor <optional>
descriptor.writable's default value is false in ES5,but it's true in BeautifulProperties.Hookable.
Source:

(static) getRaw(object, key) → {*}

Get the property value away from hook executing.
Parameters:
Name Type Description
object object
key string
Source:
See:
Returns:
Type
*

(static) hasHooks(object, key) → {boolean}

Return true if the property has hooks.
Parameters:
Name Type Description
object object
key string
Source:
See:
Returns:
Type
boolean

(static) setRaw(object, key, val)

Set the property value away from hook executing.
Parameters:
Name Type Description
object object
key string
val *
Source:
See:

Type Definitions

afterGet(val, previousVal) → {*}

Parameters:
Name Type Description
val *
previousVal *
Source:
Returns:
replacedVal
Type
*

afterSet(val, previousVal)

Parameters:
Name Type Description
val *
previousVal *
Source:

beforeGet()

Source:

beforeSet(val, previousVal) → {*}

Parameters:
Name Type Description
val *
previousVal *
Source:
Returns:
replacedVal
Type
*

refresh(val, previousVal)

Parameters:
Name Type Description
val *
previousVal *
Source: