Simplify GroupStore listener registration
This commit is contained in:
parent
1715206f62
commit
e094c32c62
4 changed files with 14 additions and 12 deletions
|
@ -29,9 +29,10 @@ export default class GroupStore extends EventEmitter {
|
|||
this._matrixClient = matrixClient;
|
||||
this._summary = {};
|
||||
this._rooms = [];
|
||||
this._fetchSummary();
|
||||
this._fetchRooms();
|
||||
this._fetchMembers();
|
||||
|
||||
this.on('error', (err) => {
|
||||
console.error(`GroupStore for ${this.groupId} encountered error`, err);
|
||||
});
|
||||
}
|
||||
|
||||
_fetchMembers() {
|
||||
|
@ -80,6 +81,13 @@ export default class GroupStore extends EventEmitter {
|
|||
this.emit('update');
|
||||
}
|
||||
|
||||
registerListener(fn) {
|
||||
this.on('update', fn);
|
||||
this._fetchSummary();
|
||||
this._fetchRooms();
|
||||
this._fetchMembers();
|
||||
}
|
||||
|
||||
getSummary() {
|
||||
return this._summary;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue