Module exposing: subscribeToCacheEntry, enqueForDeletion
// Source: https://github.com/dexie/Dexie.js | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import { delArrayItem } from '../../functions/utils';
import { CacheEntry } from '../../public/types/cache';
export function subscribeToCacheEntry(
cacheEntry: CacheEntry,
container: CacheEntry[],
requery: () => void,
signal: AbortSignal
) {
cacheEntry.subscribers.add(requery);
signal.addEventListener('abort', () => {
cacheEntry.subscribers.delete(requery);
if (cacheEntry.subscribers.size === 0) {
enqueForDeletion(cacheEntry, container);
}
});
}
function enqueForDeletion(cacheEntry: CacheEntry, container: CacheEntry[]) {
setTimeout(() => {
if (cacheE
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key