8

What's the best way to implement polling inside Lightning component. I'd like to update my component every 5-10 seconds, calling backend (i.e. Apex class) to obtain new data for rendering. Seems like there is no apex:actionPoller analogue in Lightning.

2
  • do you mean apex:actionPoller instead of apex:actionFunction?
    – Phil B
    Jul 2, 2015 at 20:49
  • Yes, sure. Sorry for typo
    – Mike Raven
    Jul 2, 2015 at 20:50

2 Answers 2

5

Is this truly a polling event, or could it handled via PushTopics? If it is based on the value changing on a record, consider using PushTopics.

For polling, setTimeout and setInterval work, just be sure to use $A.run when making calls to actions, etc.

4

Here is a good example of setInterval. I found it helpful.

Calling Apex method at regular interval from Lightning Component

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.