Classes
Members
-
last :MutationData
-
Description
Retrieves that last mutation added to the mutation stack (i.e. the "newest"), or undefined if none present
Details
-
stack :Array.<MutationData>
-
Description
Mutation stack according to its lock state.
Details
Methods
-
<async> commit() → {Promise.<MutationStack>}
-
Description
Updates the owning actor with the mutation stack changes made. Will not commit a locked buffer.
Returns
Details
-
deleteAll( [ filterFn ] ) → {MutationStack}
-
Description
Deletes all mutations from this actor's stack, effectively making the current changes permanent.
Parameters
Name Type Attributes Default Description filterFn
function <optional> () => true Optional function returning a boolean indicating if this element should be delete. By default, deletes all elements of the mutation stack.
Returns
Details
-
find( predicate ) → {MutationData|undefined}
-
Description
Searches for an element of the mutation stack that satisfies the provided predicate
Parameters
Name Type Description predicate
FilterFn Receives the argments of
Array.prototype.find
and should return a boolean indicating if the current element satisfies the predicate conditionReturns
Details
-
getName( name ) → {MutationData|undefined}
-
Description
Retrieves an element of the mutation stack that matches the provided name
Parameters
Name Type Description name
String Name of mutation (serves as a unique identifier)
Returns
Details
-
update( name, data, options ) → {MutationStack}
-
Description
Updates the mutation matching the provided name with the provided mutation info. The mutation info can be a subset of the full object if (and only if) overwrite is false.
Parameters
Name Type Description name
string name of mutation to update
data
MutationData New information, can include 'name'.
options
object Name Type Attributes Default Description overwrite
boolean <optional> false default will merge the provided info with the current values. True will replace the entire entry and requires at least the 'name' field.
Returns
Details
-
updateAll( transform [, filterFn ] ) → {MutationStack}
-
Description
Applies a given change or tranform function to the current buffer, unlocking if needed.
Parameters
Name Type Attributes Default Description transform
MutationData | function Object to merge or function to generate an object to merge from provided
MutationData
filterFn
FilterFn <optional> () => true Optional function returning a boolean indicating if this element should be modified. By default, affects all elements of the mutation stack.
Returns
Details
Type Definitions
-
FilterFn( mutation ) → {boolean}