Why is there no synchronization callback in Sencha Touch?

I want you to be able to display a message to the user after the repository synchronization has completed successfully. However, there seems to be no way to use a callback or call this synchronously. I am a little surprised that this is not provided out of the box, as this should be a common problem.

Is there any work for this?

+4
source share
1 answer

It took us years to find the right solution for this. Finally, we added a listener to the write event in the repository, which seems to work correctly. Since this is often necessary, it has been added to the storage prototype as

Ext.data.Store.prototype.syncWithListener = function(onWriteComplete, syncMethod) { this.on('write', onWriteComplete, this, {single:true}); var syncResult = syncMethod ? syncMethod.apply(this) : this.sync(); if (syncResult.added.length === 0 && syncResult.updated.length === 0 && syncResult.removed.length === 0) { this.removeListener('write', onWriteComplete, this, {single:true}); onWriteComplete(this); } return syncResult; }; 
+3
source

All Articles