forked from mystiq/hydrogen-web
use .get fallback where .getKey is not supported (Edge 15)
This commit is contained in:
parent
8e590fe53b
commit
bbf6943455
3 changed files with 15 additions and 1 deletions
|
@ -17,6 +17,10 @@ export default class QueryTarget {
|
|||
}
|
||||
}
|
||||
|
||||
supports(methodName) {
|
||||
return this._target.supports(methodName);
|
||||
}
|
||||
|
||||
get(key) {
|
||||
return reqAsPromise(this._target.get(key));
|
||||
}
|
||||
|
|
|
@ -6,6 +6,10 @@ class QueryTargetWrapper {
|
|||
constructor(qt) {
|
||||
this._qt = qt;
|
||||
}
|
||||
|
||||
supports(methodName) {
|
||||
return !!this._qt[methodName];
|
||||
}
|
||||
|
||||
openKeyCursor(...params) {
|
||||
try {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue