A trackable object with configurable save
handler. Changes to the object can be reverted incrementally
in the reverse order the changes were made.
Set virtual property definitions.
Return the changes since last save()
or init()
. By default, it returns all changes.
Number of changes to return (in reverse chronological order).
Convenience method for returning value at key
in _data
. key
can be a string or Array describing the path
under _data
.
The path under _data
.
The value at key
under _data
.
Initialize the instance. Data passed here is assumed to be the ground truth with respect to changes. All previous changes are cleared on each call.
Subscribe a callable function to a namespace.
Used to manage the subscription status via open
and close
methods.
Subscribe a callable function to a namespace, for exactly one execution.
Used to manage the subscription status via open
and close
methods.
Remove a Listener instance from the EventNamespace instance. Called with unsubscribe
method.
A true value indicates a successful pop.
Add a Listener instance to the EventNamespace instance. Called with subscribe
method.
Reverts changes to _data
made by set()
and unset()
methods.
The number of changes to revert (in reverse chronological order). By default, all changes are reverted.
Calls _save()
(if it exists). All changes are considered committed if _save
exists
and returns successfully.
Serialize the Record instance as an object. Called by #toJSON()
.
Set a value at key
in _data
. Anything set using this method will have a corresponding entry in _changes
.
Essentially deletes a property at key
under _data
. Uses of this method will have a corresponding entry in
_changes
so long as a value exists. Virtual properties cannot be unset.
If true, unset was successful. If false, there's nothing set at key
under _data
or it is
a virtual property.
A trackable object with configurable
save
handler. Changes to the object can be reverted incrementally in the reverse order the changes were made.