Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "window/prefetch"

Index

Variables

Functions

Object literals

Variables

Let options

options: { includeCacheMisses: boolean } = defaults

Type declaration

  • includeCacheMisses: boolean

Const prefetched

prefetched: Set<unknown> = new Set()

Functions

addPrefetchParam

  • addPrefetchParam(url: string): string
  • Adds the query param that indicates to the service worker that a request is a prefetch.

    Parameters

    • url: string

    Returns string

configure

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

    Parameters

    • opts: Partial<PrefetchOptions>

    Returns void

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

includeCacheMisses

includeCacheMisses: boolean = false

Generated using TypeDoc