Action

import {Action} from 'dataparcels';
import {Action} from 'react-dataparcels';
new Action({
   type: ?string,
   payload: ?*,
   keyPath: ?string[]
});

When a change occurs, Actions are used internally by dataparcels to describe each change to make. Actions are found within ChangeRequests.

Most of the time these operate invisibly, and it’s extremely rare that you’ll create these yourself.

Methods

shouldBeSynchronous()

shouldBeSynchronous(): boolean

Some types of actions (such as ping) are “synchronous”, meaning that they will ignore debouncing and buffering, propagating immediately to the top level parcel when included in a ChangeRequest. This method returns true if the action is synchronous.

isValueAction()

isValueAction(): boolean

Returns true if the action affects the original parcel’s value.

Actions such as setMeta and ping do not affect the original parcel’s value and are not value actions.

isMetaAction()

isMetaAction(): boolean

Returns true if the action affects the original parcel’s meta.

toJS()

toJS(): Object

Returns a plain Javascript object with the data contained within the action.