Edit this page

up.radio up.radio.config
JavaScript property

Configures defaults for passive updates.

Value

[config.hungrySelectors] Array<string> optional

An array of CSS selectors that is replaced whenever a matching element is found in a response. These elements are replaced even when they were not targeted directly.

By default this contains the [up-hungry] attribute.

The configured selectors will be used to find hungry elements in the current page. For each matching element a target will be derived from that specific element. E.g. when you configure up.radio.config.hungrySelectors.push('input'), a given input will be targeted with its derived selector (like input[name=email]).

For this to work hungry elements must have a derivable target selector.

[config.pollInterval=30000] number optional

The default polling interval in milliseconds.

[config.stretchPollInterval] Function(number): number optional experimental

Adjusts the given polling interval before it is used.

On a good network connection this returns the given interval unchanged. On a poor connection it returns the doubled interval, causing Unpoly to poll at half as frequently.

[config.pollEnabled=true] booleanorstringorFunction(Element) optional

Whether Unpoly will follow instructions to poll fragments, like the [up-poll] attribute.

When set to 'auto' Unpoly will skip polling updates while one of the following applies:

  • The browser tab is in the foreground
  • The fragment's layer is the frontmost layer.

When set to true, Unpoly will always allow polling.

When set to false, Unpoly will never allow polling.

To enable polling on a case-by-case basis, you may also pass a function that accepts the polling fragment and returns true, false or 'auto'. As an alternative you may also skip a polling update by preventing the up:fragment:poll event.

When an update is skipped due to polling being disabled, Unpoly will try to poll again after the configured interval.

This website uses cookies to improve usability and analyze traffic.
I accept or learn more