dojox.off.sync.ActionLog.onReplay
dojo.require("dojox.off.sync");
defined in dojox/off/sync.js
This callback should be connected to by applications so that
they can sync themselves when we go back online:
dojo.connect(dojox.off.sync.actions, "onReplay", function(action, actionLog){
// do something
})
When we replay our action log, this callback is called for each
of our action entries in the order they were added. The
'action' entry that was passed to add() for this action will
also be passed in to onReplay, so that applications can use this information
to do their syncing, such as contacting a server web-service
to create a new item, for example.
Inside the method you connected to onReplay, you should either call
parameter | type | description |
---|
action | Object | replaying or actionLog.continueReplay() to have the action log continue replaying its log and proceed to the next action; the reason you must call these is the action you execute inside of onAction will probably be asynchronous, since it will be talking on the network, and you should call one of these two methods based on the result of your network call. |
actionLog | dojox.off.sync.ActionLog | haltReplay(reason if an error occurred and you would like to haltfield | type | description |
---|
.add | | to true. For applications that are rapidly adding many action log entries in a short period of time, it can be useful to set this to false and simply call save() yourself when you are ready to persist your command log -- otherwise performance could be slow as the default action is to attempt to persist the actions log constantly with calls to add(). | .autoSave | Boolean | Whether we automatically save the action log after each call to | .clear | Function | void Completely clears this action log of its entries | .continueReplay | Function | void Indicates that we should continue processing out list of actions. | .entries | Array | An array of our action entries, where each one is simply a custom object literal that were passed to add() when this action entry was added. | .haltReplay | Function | void Halts replaying this command log. | .isReplaying | Boolean | If true, we are in the middle of replaying a command log; if false, then we are not | .length | Function | Number Returns the length of this action log | .onReplay | Function | void Called when we replay our log, for each of our action entries. | .onReplayFinished | Function | For advanced usage; most developers can ignore this. Called when we are finished replaying our commands; called if we have successfully exhausted all of our commands, or if an error occurred during replaying. The default implementation simply continues the synchronization process. Connect to this to register for the event: dojo.connect(dojox.off.sync.actions, "onReplayFinished", someFunc) | .reasonHalted | String | If we halted, the reason why | .replay | Function | void For advanced usage; most developers can ignore this. Replays all of the commands that have been cached in this command log when we go back online; onCommand will be called for each command we have | .toString | Function | | ._load | Function | | ._save | Function | |
|