Options
All
  • Public
  • Public/Protected
  • All
Menu

Options for the install function.

Hierarchy

Index

Properties

Optional cacheHost

cacheHost: undefined | string

The Edgio hostname from which to prefetch cached content. This is only used when the origin site is not served from Edgio.

Optional forcePrefetchRatio

forcePrefetchRatio: undefined | number

The probability that a prefetch request will be relayed to the origin even if a response is not in the cache. Defaults to 0. This should be a number between 0 and 1.

includeCacheMisses

includeCacheMisses: boolean

Set to true to include pages not in the edge cache when prefetching. By default pages will only be prefetched if they are available in Edgio edge cache. Warning: setting this to true will cause a significant increase in traffic to the origin server.

Optional observe

The prefetcher observes the DOM for new elements that are added for potential prefetching. Observations are made to the document's child nodes and subtree. Attributes changes are not observed by default, but can be enabled with ObserveOptionsConfig.attributes. Additionally, you can disable the observer by setting ObserveOptionsConfig.disabled to true.

Optional prefetchPatterns

prefetchPatterns: RegExp[]

Any link whose href matches one of these patterns will have its href prefetched when the link becomes visible

Optional prefetchURLs

prefetchURLs: string[]

URLs to prefetch immediately

Optional serviceWorkerPath

serviceWorkerPath: undefined | string

The URL path on which the service worker is served.

spaRoutes

spaRoutes: RegExp[]

Optional watch

A list of config objects with selectors to watch for. When elements matching the selector are found, the specified callback is called.

Example

install({ watch: [{ selector: 'div.product-tile', callback: el => { const productId = el.getAttribute('data-product-id') const catId = document.getElementById('cat-listing').getAttribute('data-category-id') prefetch(/api/${catId}/${productId}, 'fetch') } }] })

Generated using TypeDoc