0

我用 Javascript 创建了一个 mesibo 群聊。下面是我从服务器获取 indexedDB 中不存在的消息的代码。

    var rSession =  api.readDbSession('1875', ${groupId}, null,
  function on_read(count) {
    console.log(count, this.readCount, 'count')
          if(count < this.readCount){
                  this.sync(this.readCount - count,
                          function on_sync(i){
                                  if(i > 0){
                                    this.read(i);
                                          let msgs = this.getMessages();
                                          // Display messages
                                  }
                  });
                  return;
          }

          let msgs = this.getMessages();
          console.log(msgs, 'sufficent')
          //Display Messages if you have sufficient messages

      });

rSession.readCount = 1000;
rSession.read(1000)

但我从来没有进入 on_sync 函数。

4

0 回答 0