PacemDataElement
is the core element to stand on for data observing.
Its most important property is model
. Lean on it to orchestrate your ViewModel.
Basic "flat" properties are easily made observable (i.e. bindable).
Remember, as a best practice, to
use a
PacemDataElement
and itsmodel
property as the most reliable observable: it will always be guaranteed to emit apropertychange
event.
Example:
Nested properties don't always notify their change, they do if a two-way binding is set between the PacemDataElement
and the data modifiers.
This is typical in a form scenario.
Example:
Property persistAs
lets the model
of a PacemDataElement
to persist in the localStorage.
Re-entering a page having persisted data permits to have resumed the last registered changes.
Example:
Property change notifications can be debounced and throttled, in order to mitigate - for instance - eccessive DOM changes.
Here are the propeties:
debounce
: can be a number
, in that case it signifies "milliseconds", or a boolean
, which means debounce at browser's frame rate.throttle
: is a boolean
that specifies whether actual debounce algorithm should be used (when false
) or throttle instead (when true
).