Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reactive debounce and throttle functions #1510

Merged
merged 8 commits into from Dec 16, 2016
Merged

Conversation

jcheng5
Copy link
Member

@jcheng5 jcheng5 commented Dec 14, 2016

These are higher-order reactive functions to help slow down the effects of reactivity.

r <- reactive(input$chattyInput)

# r_throttled is a reactive expression with the same values as r, except it
# will update/invalidate no more than once every 500 millis
r_throttled <- r %>% throttle(500)

# Same, but will wait for r to be idle for at least 500 millis before
# updating/invalidating.
r_debounced <- r %>% debounce(500)

I also added options(device.ask.default = FALSE) to all the examples that use renderPlot. This prevents the Hit <Return> to see next plot from occurring while you're trying to run those apps.

  • Add unit tests

@jcheng5 jcheng5 added the review label Dec 14, 2016
@wch wch merged commit 55a1604 into master Dec 16, 2016
@wch wch deleted the joe/feature/debounce branch December 16, 2016 17:10
@wch wch removed the review label Dec 16, 2016
@KZARCA
Copy link

KZARCA commented Jan 17, 2017

Hi!
It would be great if the r argument could be an observer as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants