LynxResourcePrefetch
Download images and videos into the native cache before they're shown, so they appear without a delay. import { LynxResourcePrefetch, type PrefetchRequest, type PrefetchPriority, type PrefetchCacheTarget, type PrefetchResultDetail, type ResourcePrefetchResult, type ResourcePrefetchData } from '@blotch/angular-lynx';
Usage
API
LynxResourcePrefetch
Asks Lynx to fetch resources into its image and video caches.
Lynx provides prefetching only on the background thread, and your app runs on the main thread. Both methods send their call there for you, and the result comes back as JSON. See Threads.
LynxResourcePrefetch.request()
Starts prefetching. Resolves when Lynx accepts the request, which can be before the downloads finish. Rejects when prefetching isn't available.
LynxResourcePrefetch.cancel()
Cancels prefetches that are still running, for example when the user leaves the screen. Rejects when prefetching isn't available.
Types
PrefetchRequest
PrefetchPriority
PrefetchCacheTarget
PrefetchResultDetail
The result for one resource.
ResourcePrefetchResult
The overall result, with one details entry for each resource.
ResourcePrefetchData
The request in Lynx's own format, which request() and cancel() build from your PrefetchRequest list. You only need it to call lynx.requestResourcePrefetch() yourself, in a backgroundFn().
