applyCanon
applyCanon(
canonFunc?,dropPredictions?):void
Defined in: prediction.ts:136
Temporarily revert all outstanding predictions, optionally run the provided function
(which will generally make authoritative changes to the data based on a server response),
and then attempt to reapply the predictions on top of the new canonical state, dropping
any predictions that can no longer be applied cleanly (the data has been modified) or
that were specified in dropPredictions.
All of this is done such that redraws are only triggered if the overall effect is an
actual change to an Observable.
Parameters
Section titled “Parameters”canonFunc?
Section titled “canonFunc?”() => void
The function to run without any predictions applied. This will typically make authoritative changes to the data, based on a server response.
dropPredictions?
Section titled “dropPredictions?”Patch[] = []
An optional list of predictions (as returned by applyPrediction)
to undo. Typically, when a server response for a certain request is being handled,
you’d want to drop the prediction that was done for that request.
Returns
Section titled “Returns”void