Module Fragments

Index

Functions

Functions

cache(href: string): Promise

Starts loading the fragment at the specified location. The returned promise completes when the fragment is ready to be copied.

Parameters

  • href: string

    The URI that contains the fragment to be copied.

Returns

Promise

A promise that is fulfilled when the fragment has been prepared for copying.

clearCache(href: string)

Removes any cached information about the specified fragment. This method does not unload any scripts or styles that are referenced by the fragment.

Parameters

  • href: string

    The URI that contains the fragment to be cleared. If no URI is provided, the entire contents of the cache are cleared.

render(href: string, element?: HTMLElement): Promise

Loads the contents of the specified URI into the specified element without copying it.

Parameters

  • href: string

    The URI that contains the fragment to copy.

  • element?: HTMLElement optional

    Optional. The element to which the fragment is appended.

Returns

Promise

A promise that is fulfilled when the fragment has been loaded. If a target element is not specified, the copied fragment is the completed value. The element is not added to the cache. See also rendercopy, where the element is added to the cache.

renderCopy(href: string, target?: HTMLElement): Promise

Loads and copies the contents of the specified URI into the specified element.

Parameters

  • href: string

    The URI that contains the fragment to copy.

  • target?: HTMLElement optional

    The element to which the fragment is appended.

Returns

Promise

A promise that is fulfilled when the fragment has been loaded. If a target element is not specified, the copied fragment is the completed value. The fragment is added to the cache. See also render, where the element is not added to the cache.