1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-29 16:43:09 +03:00

Smush connect() and init() together

This commit is contained in:
David Baker
2017-04-07 15:06:38 +01:00
parent e2d7b465ae
commit 0f29952a1c
4 changed files with 3 additions and 13 deletions

View File

@@ -133,13 +133,15 @@ LocalIndexedDBStoreBackend.prototype = {
this.db.onversionchange = () => {
this.db.close();
};
return this._init();
});
},
/**
* Having connected, load initial data from the database and prepare for use
*/
init: function() {
_init: function() {
return q.all([
this._loadAccountData(),
this._loadSyncData(),

View File

@@ -55,13 +55,6 @@ RemoteIndexedDBStoreBackend.prototype = {
});
},
/**
* Having connected, load initial data from the database and prepare for use
*/
init: function() {
return this._doCmd('init');
},
/**
* Clear the entire database. This should be used when logging out of a client
* to prevent mixing data between accounts.

View File

@@ -66,9 +66,6 @@ class IndexedDBStoreWorker {
case 'connect':
prom = this.backend.connect();
break;
case 'init':
prom = this.backend.init();
break;
case 'clearDatabase':
prom = this.backend.clearDatabase().then((result) => {
// This returns special classes which can't be cloned

View File

@@ -109,8 +109,6 @@ IndexedDBStore.prototype.startup = function() {
}
return this.backend.connect().then(() => {
return this.backend.init();
}).then(() => {
return this.backend.getUserPresenceEvents();
}).then((userPresenceEvents) => {
userPresenceEvents.forEach(([userId, rawEvent]) => {