Edit this page

up.radio up.radio.startPolling(fragment, [options])
JavaScript function

Starts polling the given element.

The given element does not need an [up-poll] attribute.


Parameters

fragment Element

The fragment to reload periodically.

[options] Object optional

Options for reloading the fragment.

By default Unpoly will parse options from the fragment's attributes like ([up-interval]). You may pass this additional options object to supplement or override options parsed from the fragment's attributes.

[options.interval] number optional

The reload interval in milliseconds.

Defaults to up.radio.config.pollInterval.

[options.url] string optional

The URL from which to reload the fragment.

Defaults to the URL this fragment was originally loaded from.

[options.method='get'] string optional experimental

The HTTP method used to reload the fragment.

[options.headers={}] string optional

A JSON object with additional request headers.

[options.params={}] string optional

A JSON object with additional parameters that should be sent as the request's query string or payload.

When making a GET request to a URL with a query string, the given { params } will be added to the query parameters.

[options.keepData=false] optional experimental

Whether to preserve the polling fragment's data object through reloads.

[options.ifLayer='front'] string optional experimental

Controls polling while the fragment's layer is covered by an overlay.

When set to 'front', polling will pause while the fragment's layer is covered by an overlay. When the fragment's layer is uncovered, polling will resume.

When set to 'any', polling will continue on background layers.