use .get fallback where .getKey is not supported (Edge 15)

This commit is contained in:
Bruno Windels 2019-09-15 12:24:27 +02:00
parent 8e590fe53b
commit bbf6943455
3 changed files with 15 additions and 1 deletions

View File

@ -17,6 +17,10 @@ export default class QueryTarget {
}
}
supports(methodName) {
return this._target.supports(methodName);
}
get(key) {
return reqAsPromise(this._target.get(key));
}

View File

@ -6,6 +6,10 @@ class QueryTargetWrapper {
constructor(qt) {
this._qt = qt;
}
supports(methodName) {
return !!this._qt[methodName];
}
openKeyCursor(...params) {
try {

View File

@ -36,7 +36,13 @@ export default class PendingEventStore {
async exists(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;
}