Constructor
new AvenxWatcher(getter, callbackopt, optionsopt)
Parameters:
- Source:
Classes
Members
callback :function|null
Type:
- function | null
- Source:
debounceTimer :any
Type:
- any
- Source:
deps :Set:.<{target:: object:, key:: string:, watchersSet:: Set:.<AvenxWatcher:>}>
Type:
- Set:.<{target:: object:, key:: string:, watchersSet:: Set:.<AvenxWatcher:>}>
- Source:
dirty :boolean
Type:
- boolean
- Source:
getter :function|Array:.<function()>
Type:
- Source:
isArray :boolean
Type:
- boolean
- Source:
isEffect :boolean
Type:
- boolean
- Source:
lastExecTime :number
Type:
- number
- Source:
name :string
Type:
- string
- Source:
options :object
Type:
- object
- Source:
pendingNewValue :any
Type:
- any
- Source:
pendingOldValue :any
Type:
- any
- Source:
throttleTimer :any
Type:
- any
- Source:
value :any
Type:
- any
- Source:
Methods
addDep(target, key, watchersSet)
Registers a target property dependency on this watcher.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
object | Reactive object target. |
key |
string | Property key. |
watchersSet |
Set:.<AvenxWatcher:> | Set mapping to this dependency. |
- Source:
cleanupDeps(oldDeps)
Compares active dependencies against old dependencies and unsubscribes from stale dependencies.
Parameters:
| Name | Type | Description |
|---|---|---|
oldDeps |
Set:.<{target:: object:, key:: string:, watchersSet:: Set:.<AvenxWatcher:>}> |
- Source:
evaluate() → {any}
Evaluates a lazy computed watcher if it is dirty.
- Source:
Returns:
- Type
- any
get() → {any}
Evaluates the getter function inside the watcher context to track reactive dependencies.
- Source:
Returns:
- Type
- any
pause()
Pauses watcher execution.
- Source:
resume()
Resumes watcher execution.
- Source:
run(newValue, oldValue)
Executes the watcher callback, applying debounce or throttle timing if configured.
Parameters:
| Name | Type | Description |
|---|---|---|
newValue |
any | |
oldValue |
any |
- Source:
teardown()
Cleans up all registered dependencies of this watcher to prevent memory leaks.
- Source:
update()
Updates the watcher value and triggers evaluation or callback execution.
- Source: