Constructor
new TransactionContext(binding, promiseopt)
Transaction context constructor.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
binding |
Binding | binding | |
promise |
Promise |
<optional> |
ES6 promise |
- Source:
Methods
cancel()
Cancel this transaction.
Committing cancelled transaction won't have any effect.
For committed transactions affected paths will be reverted to original values,
overwriting any changes made after transaction has been committed.
- Source:
clear(bindingopt, subpathopt) → {TransactionContext}
Clear collection or nullify nested value.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
binding |
Binding |
<optional> |
binding to apply update to |
subpath |
String | Array |
<optional> |
subpath as a dot-separated string or an array of strings and numbers |
- Source:
Returns:
updated transaction context
- Type
- TransactionContext
commit(optionsopt) → {TransactionContext}
Commit transaction (write changes and notify listeners).
Parameters:
Name | Type | Attributes | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
options object
Properties
|
- Source:
Returns:
updated transaction context
- Type
- TransactionContext
isCancelled() → {Boolean}
Check if transaction was cancelled, either manually or due to promise failure.
- Source:
Returns:
cancelled flag
- Type
- Boolean
isCommitted() → {Boolean}
Check if transaction was committed.
- Source:
Returns:
committed flag
- Type
- Boolean
merge(bindingopt, subpathopt, preserveopt, newValue) → {TransactionContext}
Deep merge values.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
binding |
Binding |
<optional> |
binding to apply update to | |
subpath |
String | Array |
<optional> |
subpath as a dot-separated string or an array of strings and numbers | |
preserve |
Boolean |
<optional> |
false | preserve existing values when merging |
newValue |
* | new value |
- Source:
Returns:
updated transaction context
- Type
- TransactionContext
remove(bindingopt, subpathopt) → {TransactionContext}
Remove value.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
binding |
Binding |
<optional> |
binding to apply update to |
subpath |
String | Array |
<optional> |
subpath as a dot-separated string or an array of strings and numbers |
- Source:
Returns:
updated transaction context
- Type
- TransactionContext
set(bindingopt, subpathopt, newValue) → {TransactionContext}
Set binding value.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
binding |
Binding |
<optional> |
binding to apply update to |
subpath |
String | Array |
<optional> |
subpath as a dot-separated string or an array of strings and numbers |
newValue |
* | new value |
- Source:
Returns:
updated transaction context
- Type
- TransactionContext
update(bindingopt, subpathopt, f) → {TransactionContext}
Update binding value.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
binding |
Binding |
<optional> |
binding to apply update to |
subpath |
String | Array |
<optional> |
subpath as a dot-separated string or an array of strings and numbers |
f |
function | update function |
- Source:
Returns:
updated transaction
- Type
- TransactionContext