mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-25 12:35:01 +01:00
Add getStateEvent in room
This commit is contained in:
parent
004e3cb924
commit
d37910c5ac
@ -56,7 +56,6 @@ const PUSHER_KEY = "pusher";
|
|||||||
export class Session {
|
export class Session {
|
||||||
// sessionInfo contains deviceId, userId and homeserver
|
// sessionInfo contains deviceId, userId and homeserver
|
||||||
constructor({storage, hsApi, sessionInfo, olm, olmWorker, platform, mediaRepository}) {
|
constructor({storage, hsApi, sessionInfo, olm, olmWorker, platform, mediaRepository}) {
|
||||||
window.session = this
|
|
||||||
this._platform = platform;
|
this._platform = platform;
|
||||||
this._storage = storage;
|
this._storage = storage;
|
||||||
this._hsApi = hsApi;
|
this._hsApi = hsApi;
|
||||||
|
@ -73,6 +73,11 @@ export class BaseRoom extends EventEmitter {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getStateEvent(type, key = '') {
|
||||||
|
const txn = await this._storage.readTxn(['roomState']);
|
||||||
|
return txn.roomState.get(this.id, type, key);
|
||||||
|
}
|
||||||
|
|
||||||
async _addStateObserver(stateObserver, txn) {
|
async _addStateObserver(stateObserver, txn) {
|
||||||
if (!txn) {
|
if (!txn) {
|
||||||
txn = await this._storage.readTxn([this._storage.storeNames.roomState]);
|
txn = await this._storage.readTxn([this._storage.storeNames.roomState]);
|
||||||
|
Loading…
Reference in New Issue
Block a user