code: function SyncApi(client, opts) {
      this.client = client;
      opts = opts || {};
      opts.initialSyncLimit = (
          opts.initialSyncLimit === undefined ? 8 : opts.initialSyncLimit
      );
      opts.resolveInvitesToProfiles = opts.resolveInvitesToProfiles || false;
      opts.pollTimeout = opts.pollTimeout || (30 * 1000);
      opts.pendingEventOrdering = opts.pendingEventOrdering || "chronological";
      if (!opts.canResetEntireTimeline) {
          opts.canResetEntireTimeline = function(roomId) {
              return false;
          };
      }
      this.opts = opts;
      this._peekRoomId = null;
      this._currentSyncRequest = null;
      this._syncState = null;
      this._syncStateData = null; // additional data (eg. error object for failed sync)
      this._catchingUp = false;
      this._running = false;
      this._keepAliveTimer = null;
      this._connectionReturnedDefer = null;
      this._notifEvents = []; // accumulator of sync events in the current sync response
      this._failedSyncCount = 0; // Number of consecutive failed /sync requests
      this._storeIsInvalid = false; // flag set if the store needs to be cleared before we can start
  
      if (client.getNotifTimelineSet()) {
          client.reEmitter.reEmit(client.getNotifTimelineSet(),
                 ["Room.timeline", "Room.timelineReset"]);
      }
  }
docs: <b>Internal class - unstable.</b>
  Construct an entity which is able to sync with a homeserver.
  @constructor
  @param {MatrixClient} client The matrix client instance to use.
  @param {Object} opts Config options
  @param {module:crypto=} opts.crypto Crypto manager
  @param {Function=} opts.canResetEntireTimeline A function which is called
  with a room ID and returns a boolean. It should return 'true' if the SDK can
  SAFELY remove events from this room. It may not be safe to remove events if
  there are other references to the timelines for this room.
  Default: returns false.
  @param {Boolean=} opts.disablePresence True to perform syncing without automatically
  updating presence.