• Prefetches and caches the specified URL.

    Example

    import { prefetch } from '@edgio/prefetch/window

    // Prefetches the URL with default PrefetchConfiguration
    prefetch('/some/url')

    // Prefetches the URL as fetch with custom PrefetchConfiguration
    prefetch('/some/url', "fetch", {
    // Overrides the default Prefetch TTL or serviceWorkerSeconds value defined in routes.js
    // for this specific prefetch call
    maxAgeSeconds: 300, // 5 minutes

    // Overrides the default forcePrefetchRatio value from install() function
    includeCacheMisses: true
    });

    Parameters

    • url: string

      The URL to prefetch

    • as: PrefetchAs = 'fetch'

      Value to use for the "as" attribute of the tag

    • config: PrefetchConfiguration = ...

      Options to use for the prefetch

    Returns Promise<void>

Generated using TypeDoc