๐ src/downloader/adapters/solid.ts
D-OPEN SOVEREIGN
Documentation & Insights
Reactive LRU auto-cleanup state.
Usage:
const pruning = usePruning() // call pruning() in JSX to read reactively
pruning().active // true while cleanup runs
pruning().freedBytes // bytes freed in the last run1/*
2 * Copyright (c) 2026 DataPond D-Library Pty Ltd. ("The Sanctuary")
3 * Non-Profit Public Library โ The World Library
4 *
5 * D-SAFE Certification issued by POND Enterprise.
6 * Published under the D-Open Code Sovereign Licence v1.0 framework
7 * DataPond D-Library All exclusive Right reserved on modifiying the code - CC Attribution to data pond, Non modifiable, Non Commercial.
8 * https://registry.world.bibliotech.com/licence
9 * Source code donated to DataPond D-Library by it's author: data pond.
10 *
11 * Technical Guardian ("The Shield"): Pond Enterprise Pty Ltd. (ACN 694 747 987)
12 * All liability claims about D-SAFE certification issues coming from the published D-Safe direction must be addressed with Pond Enterprise Pty Ltd.
13 * Code Modification automatically voids the certified liability protection provided by Pond Enterprise.
14 */
15// Solid.js adapter โ signal-based reactive bridge (ยง5.6.4).
16import { createSignal } from 'solid-js';
17import { downloadState } from '../state';
18
19const [tick, setTick] = createSignal(0);
20downloadState.subscribe(() => setTick(t => t + 1));
21
22export const useFileStatus = (txId: string) => () => (tick(), downloadState.get(txId));
23export const useRenderStatus = (txId: string) => () => (tick(), downloadState.getRender(txId));
24export const useGlobalProgress = () => () => (tick(), downloadState.summary());
25
26/**
27 * Reactive LRU auto-cleanup state.
28 *
29 * Usage:
30 * const pruning = usePruning() // call pruning() in JSX to read reactively
31 * pruning().active // true while cleanup runs
32 * pruning().freedBytes // bytes freed in the last run
33 */
34export const usePruning = () => () => (tick(), downloadState.pruning);
35