in workbox-v4.3.1/workbox-core.dev.js [1156:1196]
async getAllMatching(storeName, {
index,
query = null,
// IE errors if query === `undefined`.
direction = 'next',
count,
includeKeys
} = {}) {
return await this.transaction([storeName], 'readonly', (txn, done) => {
const store = txn.objectStore(storeName);
const target = index ? store.index(index) : store;
const results = [];
target.openCursor(query, direction).onsuccess = ({
target
}) => {
const cursor = target.result;
if (cursor) {
const {
primaryKey,
key,
value
} = cursor;
results.push(includeKeys ? {
primaryKey,
key,
value
} : value);
if (count && results.length >= count) {
done(results);
} else {
cursor.continue();
}
} else {
done(results);
}
};
});
}