store.sync() callback

醉酒当歌 提交于 2019-12-19 11:47:21

问题


Is there a callback for store.sync()?

I am trying to do:

store.sync(function(){
   alert('1');
});

but it does not work. The store is a local store.


回答1:


There is no 'callback' for sync(). In order to achieve this behaviour, you will need to listen to the store's write event. Check this solution.




回答2:


You can try:

store.sync({
    callback: function (records, operation) {
        alert('1');
    }
});



回答3:


There is the way to listen success event

store.on('write', function(){
    alert('ready');
});
store.sync();

write fires whenever a successful write has been made via the configured Proxy



来源:https://stackoverflow.com/questions/15912694/store-sync-callback

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!