You've already forked matrix-js-sdk
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:
@@ -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(),
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]) => {
|
||||
|
||||
Reference in New Issue
Block a user