store.sync() callback

2019-02-21 04:35发布

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.

3条回答
Deceive 欺骗
2楼-- · 2019-02-21 05:20

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

查看更多
We Are One
3楼-- · 2019-02-21 05:28

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.

查看更多
叛逆
4楼-- · 2019-02-21 05:30

You can try:

store.sync({
    callback: function (records, operation) {
        alert('1');
    }
});
查看更多
登录 后发表回答