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) { get(key) {
return reqAsPromise(this._target.get(key)); return reqAsPromise(this._target.get(key));
} }

View file

@ -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 {

View file

@ -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;
} }