mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
use .get fallback where .getKey is not supported (Edge 15)
This commit is contained in:
parent
8e590fe53b
commit
bbf6943455
@ -17,6 +17,10 @@ export default class QueryTarget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
supports(methodName) {
|
||||||
|
return this._target.supports(methodName);
|
||||||
|
}
|
||||||
|
|
||||||
get(key) {
|
get(key) {
|
||||||
return reqAsPromise(this._target.get(key));
|
return reqAsPromise(this._target.get(key));
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,10 @@ class QueryTargetWrapper {
|
|||||||
constructor(qt) {
|
constructor(qt) {
|
||||||
this._qt = qt;
|
this._qt = qt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
supports(methodName) {
|
||||||
|
return !!this._qt[methodName];
|
||||||
|
}
|
||||||
|
|
||||||
openKeyCursor(...params) {
|
openKeyCursor(...params) {
|
||||||
try {
|
try {
|
||||||
|
@ -36,7 +36,13 @@ export default class PendingEventStore {
|
|||||||
|
|
||||||
async exists(roomId, queueIndex) {
|
async exists(roomId, queueIndex) {
|
||||||
const keyRange = IDBKeyRange.only(encodeKey(roomId, queueIndex));
|
const keyRange = IDBKeyRange.only(encodeKey(roomId, queueIndex));
|
||||||
const key = await this._eventStore.getKey(keyRange);
|
let key;
|
||||||
|
if (this._eventStore.supports("getKey")) {
|
||||||
|
key = await this._eventStore.getKey(keyRange);
|
||||||
|
} else {
|
||||||
|
const value = await this._eventStore.get(keyRange);
|
||||||
|
key = value && value.key;
|
||||||
|
}
|
||||||
return !!key;
|
return !!key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user