packages/lobsang-connect-matrix/lib/connect.js
function connect (client) {
  client.startClient()

  return new Promise((resolve, reject) => {
    client.once('sync', (state) => {
      if (wrapper.isSyncState(state)) {
        return resolve(client)
      } else {
        return reject(new Error('Client could not sync'))
      }
    })
  })
}
function connect (client) {
  client.startClient()

  return new Promise((resolve, reject) => {
    client.once('sync', (state) => {
      if (wrapper.isSyncState(state)) {
        return resolve(client)
      } else {
        return reject(new Error('Client could not sync'))
      }
    })
  })
}
@module @lobsangnet/lobsang-connect-matrix/connect
 
Connects to a MatrixClient and resolves once connection was established.

@private
@param {MatrixClient} client - The client used for connection.
@returns {Promise<MatrixClient|Error>}
Promise which resolves to a connected MatrixClient.
Or an Error if connection could not be established.