Skip to content

Clarify use of filters for polling triggers#3710

Open
codesoap wants to merge 1 commit intobigskysoftware:masterfrom
codesoap:polling_conditions
Open

Clarify use of filters for polling triggers#3710
codesoap wants to merge 1 commit intobigskysoftware:masterfrom
codesoap:polling_conditions

Conversation

@codesoap
Copy link

Description

I found the documentation for filters on polling triggers with hx-trigger="every 1s [...]" less useful than it could be. I initially did not understand, that a filter could be any JavaScript expression. I have clarified this and changed the example to a common scenario: The polling is paused when a tab is in the background.

Testing

I have created some test HTML with this body:

<body	hx-get="file:///tmp/index.html"	hx-trigger="every 5s [!document.hidden]"> 

I could see in the developer console, that requests were triggered, when the tab was being viewed, but not when I was looking at another tab.

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for
    source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly
    approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded
    • Is this necessary for documentation changes?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant