Adds an action to the action queue.
If the synchronization process is already running, and an action that does not have the "lax" flag set in the options parameter is added to the queue, the synchronization process is restarted.
Name | Description | Type | Use |
---|---|---|---|
type | This parameter is ignored. | string |
required |
handle | This parameter is ignored. | string |
required |
metadata | Action's meta data. | string |
required |
data | The action's data string. | string |
required |
onSuccess | A callback function, informs that the operation completed successfully. The onSuccess
function takes an id parameter that is used to identify the action that was just
added. |
function |
required |
onFailure | A callback function, called when the operation fails. Returns an error code, as defined in the Constants table in the Client Store article, and an error message. | function |
required |
options | A JavaScript object containing optional flags. | object |
optional |
The options
object contains flags that enable action filtering in the getQueuedActionsCount and listActions methods. It is structured as
follows:
{ silent, lax, negligible }
Name | Description | Type | Use |
---|---|---|---|
silent |
By setting this flag to "true" you can filter out actions from the results of the getQueuedActionsCount and listActions methods. |
boolean |
optional |
lax | By setting this flag to "true" you can filter out actions from the results of the getQueuedActionsCount and listActions methods. Actions that have this flag set to "true" do not restart the synchronization process if added to the queue when the synchronization is in progress. | boolean |
optional |
negligible | By setting this flag to "true" you can filter out actions from the results of the getQueuedActionsCount and listActions methods. | boolean |
optional |
For the synchronization process to execute as designed, both metadata
and data
strings must contain a proper JSON object.