Edit this page

up.fragment up.fragment.onKept(element, callback)
JavaScript function

This feature is experimental. Please share your experiences so we know what to keep or change.

Runs a callback when the given element or its ancestors were kept.


Parameters

element
required

The element to observe with its ancestors.

callback
required

The callback to run.

It will be called with an up:fragment:kept argument.

Function(event)

Return value

A function that unsubscribes the callback.

When the element is destroyed, the callback will be unsubscribed automatically.

Function