new DataCacheOperation(stateMachine, promise, isCancelable, index, count, data, pending) → {DataCacheOperation}
Creates a new operation object.
Parameters:
Name | Type | Description |
---|---|---|
stateMachine |
function | State machine that describes the specific behavior of the operation. |
promise |
DjsDeferred | Promise for requested values. |
isCancelable |
Boolean | Whether this operation can be canceled or not. |
index |
Number | Index of first item requested. |
count |
Number | Count of items requested. |
data |
Array | Array with the items requested by the operation. |
pending |
Number | Total number of pending prefetch records. |
Returns:
A new data cache operation instance.
- Type
- DataCacheOperation
Methods
-
cancel()
-
Transitions this operation to the cancel state and sets the canceled flag to true. The function is a no-op if the operation is non-cancelable.
-
complete()
-
Transitions this operation to the end state.
-
error()
-
Transitions this operation to the error state.
-
fireCanceled()
-
Fires a canceled notification as necessary.
-
fireRejected()
-
Fires a rejected notification as necessary.
-
fireResolved()
-
Fires a resolved notification as necessary.
-
operationStateMachine(opTargetState, cacheState, data)
-
State machine that describes all operations common behavior.
Parameters:
Name Type Argument Description opTargetState
Object Operation state to transition to. cacheState
Object Current cache state. data
Object <optional>
Additional data passed to the state. -
run(state)
-
Executes the operation's current state in the context of a new cache state.
Parameters:
Name Type Description state
Object New cache state. -
transition(state, data)
-
Transitions this operation to a new state.
Parameters:
Name Type Argument Description state
Object State to transition the operation to. data
Object <optional>
- -
wait()
-
Transitions this operation to the wait state.