Constructor
new JournalFrame(optionsopt)
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
Frame options. Properties
|
- Source:
Members
collectionIndex :Map:.<object:, object:>
Type:
- Source:
collections :Array:.<object:>
Collection savepoints, in first-touch order.
Type:
- Source:
empty
Whether the frame recorded anything at all.
- Source:
entries :Array:.<object:>
Property writes, in first-touch order.
Type:
- Source:
index :Map:.<object:, Map:.<(string:|number:), object:>>
Target to key to entry, for deduplication.
Type:
- Source:
maxSnapshotItems :number
Type:
- number
- Source:
name :string
Type:
- string
- Source:
onConflict :string
Type:
- string
- Source:
owner :string
Type:
- string
- Source:
settled :boolean
Type:
- boolean
- Source:
unrewindable :Array:.<string:>
Paths this frame knows it cannot restore, discovered while recording.
Type:
- Source:
Methods
recordCollection(target, handler, fallback) → {void}
Takes a savepoint of a collection before it is mutated.
An array method, a Map.set or a Set.add has no single before-and-after
pair to journal — splice can move every element at once — so the whole
container is copied, once, the first time the transaction touches it.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
object | The raw array, Map or Set. |
handler |
object | The ProxyHandlerFactory that owns this target. |
fallback |
string | What to call it when it has no resolvable path. |
- Source:
Returns:
- Type
- void
recordDelete(target, key, oldValue, existed, handler) → {void}
Records a deletion.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
object | The raw object. |
key |
string | number | The deleted key. |
oldValue |
any | The value it held. |
existed |
boolean | Whether the key was there to begin with. |
handler |
object | The ProxyHandlerFactory that owns this target. |
- Source:
Returns:
- Type
- void
recordWrite(target, key, oldValue, newValue, existed, handler) → {void}
Records a property write.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
object | The raw object that was mutated. |
key |
string | number | The mutated key. |
oldValue |
any | The value before the mutation. |
newValue |
any | The value after it. |
existed |
boolean | Whether the key was an own property beforehand. |
handler |
object | The ProxyHandlerFactory that owns this target. |
- Source:
Returns:
- Type
- void
rewind() → {Object}
Plays the frame backwards.
Property writes are restored through the handler that recorded them, so a rewind wakes watchers exactly as the original write did. Collections are restored in place and then triggered, because there is no single key whose assignment would describe the change.
- Source:
Returns:
What the rewind managed to do.
- Type
- Object