Access
Direct Subclass:
The base class for Shadow.$()
method used for obtaining f.lux contextual information
concerning a non-primitive shadow state property.
The most commonly used methods include:
This class provides access to the experimental Property checkpointing api. Checkpointing allows the state to be recorded at a point in time and then later reset to that point. This is handy when a form may accept changes and then allow the user to cancel the edit session.
See:
Constructor Summary
Public Constructor | ||
public |
constructor(impl: *) |
Member Summary
Public Members | ||
public |
[_impl]: * |
Method Summary
Public Methods | ||
public |
Copies the current actual state for later reset using Property#resetToCheckpoint. |
|
public |
Clears an existing checkpoint created using Property#checkpoint. |
|
public |
Gets the path from root property using a dot ( |
|
public |
getCheckpoint(): Object | Array Gets the checkpoint state previously recorded using Property#checkpoint. |
|
public |
Gets if an existing checkpoint has be created using Property#checkpoint. |
|
public |
Gets if the shadow state property is proxying the current actual state contained in the f.lux store. |
|
public |
Gets if the property allows for assignment through the shadow state, ie |
|
public |
Gets if the shadow property has experienced a mutation action. |
|
public |
Gets the current shadow state for this property. |
|
public |
Gets the next actual state for this property following any pending actions. |
|
public |
path(): [] Gets the Property#name components from the root property to this property. |
|
public |
Gets the unique f.lux ID for this property. |
|
public |
Gets the Property managing this shadow property. |
|
public |
Replaces the current property state with a checkpoint state previously recorded using Property#checkpoint. |
|
public |
rootShadow(): Shadow Gets the top-level shadow from the Store containing this shadow state property. |
|
public |
shadow(): * |
|
public |
Gets the path from root property using a slash ( |
|
public |
Gets the actual state being shadowed. |
|
public |
Gets the {@Link Store} containing the application state. |
|
public |
update(callback: *) Performs an update on the state values. |
|
public |
Registers a one-time no argument callback to be invoked after the next Store state change. |
Public Constructors
public constructor(impl: *) source
Params:
Name | Type | Attribute | Description |
impl | * |
Public Members
public [_impl]: * source
Public Methods
public checkpoint() source
Copies the current actual state for later reset using Property#resetToCheckpoint. An existing checkpoint will take precedence over subsequent calls.
public dotPath(): string source
Gets the path from root property using a dot (.
) separator. Suitable for using with the lodash result()
function.
public getCheckpoint(): Object | Array source
Gets the checkpoint state previously recorded using Property#checkpoint.
public hasCheckpoint(): boolean source
Gets if an existing checkpoint has be created using Property#checkpoint.
public isActive(): boolean source
Gets if the shadow state property is proxying the current actual state contained in the f.lux store.
public isReadonly(): boolean source
Gets if the property allows for assignment through the shadow state, ie todo.desc = "go skiing"
. The
readonly attribute is hierarchically determined through the parent property if not explicitly set.
public isValid(): boolean source
Gets if the shadow property has experienced a mutation action. This method will return true
and
Access#isActive may also return true if the f.lux store has not yet been transitioned to
the next state.
public latest(): Shadow source
Gets the current shadow state for this property. The shadow state referenced by this access object could be stale if a javascript closure has a previous reference and then performed an asynchronous operation like a network request.
public nextState(): Object | Array source
Gets the next actual state for this property following any pending actions.
public path(): [] source
Gets the Property#name components from the root property to this property.
Return:
[] | array where each name component is either a |
public resetToCheckpoint() source
Replaces the current property state with a checkpoint state previously recorded using Property#checkpoint. The checkpoint is cleared.
public rootShadow(): Shadow source
Gets the top-level shadow from the Store containing this shadow state property.
public update(callback: *) source
Performs an update on the state values.
The callback should be pure and have the form:
callback(nextState) : nextState
- or -
callback(nextState) : { name, nextState }
The nextState
parameter is a javascript object (not a Shadow
) that represents the next state starting
from the current state and having all the actions in the current tick applied to it before this update()
call.
The callback should return an object with the following properties:
-
name
- a stort moniker identifying the update call purpose. This will passed to the store middleware. This value is optional with the default value being '[path].$().update()'. nextState
- the value for the next state after the update functionality.
Params:
Name | Type | Attribute | Description |
callback | * |