Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "window/prefetch"

Index

Variables

Let options

options: PrefetchOptions = defaults

Const prefetched

prefetched: Set<unknown> = new Set()

Functions

configure

  • configure(opts: Partial<PrefetchOptions>): void
  • Configures prefetching options

    Parameters

    • opts: Partial<PrefetchOptions>

    Returns void

maybeAddHeadParam

  • maybeAddHeadParam(url: URL): void
  • Parameters

    • url: URL

    Returns void

maybeAddPrefetchParam

  • maybeAddPrefetchParam(url: URL): void
  • Adds the query param that indicates to the service worker that a request is a prefetch.

    Parameters

    • url: URL

    Returns void

modifyUrl

  • modifyUrl(url: string): string
  • Parameters

    • url: string

    Returns string

prefetch

  • prefetch(url: string, as?: string): Promise<void>
  • Prefetches and caches the specified URL.

    Example

    import { prefetch } from '@xdn/prefetch/window
    
    prefetch('/some/url')

    Parameters

    • url: string

      The URL to prefetch

    • Default value as: string = "fetch"

    Returns Promise<void>

Object literals

Const defaults

defaults: object

cacheHost

cacheHost: undefined = undefined

includeCacheMisses

includeCacheMisses: boolean = false

spaRoutes

spaRoutes: never[] = []

Generated using TypeDoc