1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-23 22:42:10 +03:00
This commit is contained in:
Kegan Dougal
2015-12-09 11:16:46 +00:00
parent 529fb23555
commit 0576e4ca0c
2 changed files with 21 additions and 4 deletions

View File

@@ -2451,6 +2451,9 @@ function _PojoToMatrixEventMapper(client) {
return mapper;
}
/**
* @return {Function}
*/
MatrixClient.prototype.getEventMapper = function() {
return _PojoToMatrixEventMapper(this);
};

View File

@@ -187,10 +187,18 @@ function SyncApi(client) {
this.opts = {};
}
/**
* @param {string} roomId
* @return {Room}
*/
SyncApi.prototype.createRoom = function(roomId) {
return createNewRoom(this.client, roomId);
};
/**
* @param {Room} room
* @return {Promise}
*/
SyncApi.prototype.syncRoom = function(room) {
return _syncRoom(this.client, room);
};
@@ -203,10 +211,13 @@ SyncApi.prototype.syncRoom = function(room) {
SyncApi.prototype.sync = function(opts) {
console.log("SyncApi.sync");
this.opts = opts || {};
return this._prepareForSync();
this._prepareForSync();
};
/**
* @param {Number=} attempt
*/
SyncApi.prototype._prepareForSync = function(attempt) {
var client = this.client;
var self = this;
@@ -231,6 +242,9 @@ SyncApi.prototype._prepareForSync = function(attempt) {
});
};
/**
* @param {Number=} attempt
*/
SyncApi.prototype._sync = function(attempt) {
var opts = this.opts;
var client = this.client;
@@ -367,15 +381,14 @@ SyncApi.prototype._sync = function(attempt) {
/**
* This is an internal method.
* @param {MatrixClient} client
* @param {Number} attempt The attempt number
* @param {Number=} attempt The attempt number
*/
SyncApi.prototype._pollForEvents = function(attempt) {
var client = this.client;
var self = this;
attempt = attempt || 1;
if (!client.clientRunning) {
return;
}
@@ -518,4 +531,5 @@ SyncApi.prototype._pollForEvents = function(attempt) {
});
};
/** */
module.exports = SyncApi;