mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-29 03:00:45 -04:00
Don't require session to be explicitly passed to invalidateLater
These functions were created before getDefaultReactiveDomain() existed, so the only way to get ahold of the current session was if the caller explicitly passed it. This is slightly backwards incompatible, in that existing calls to invalidateLater() that don't pass a session argument will behave slightly differently (bound to the current session instead of to no session), but those calls would have triggered a warning for all but the very earliest versions of Shiny.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
\alias{invalidateLater}
|
||||
\title{Scheduled Invalidation}
|
||||
\usage{
|
||||
invalidateLater(millis, session)
|
||||
invalidateLater(millis, session = getDefaultReactiveDomain())
|
||||
}
|
||||
\arguments{
|
||||
\item{millis}{Approximate milliseconds to wait before invalidating the
|
||||
@@ -45,7 +45,7 @@ shinyServer(function(input, output, session) {
|
||||
# input$n changes.
|
||||
output$plot <- renderPlot({
|
||||
# Re-execute this reactive expression after 2000 milliseconds
|
||||
invalidateLater(2000, session)
|
||||
invalidateLater(2000)
|
||||
hist(isolate(input$n))
|
||||
})
|
||||
})
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
\alias{reactiveTimer}
|
||||
\title{Timer}
|
||||
\usage{
|
||||
reactiveTimer(intervalMs = 1000, session)
|
||||
reactiveTimer(intervalMs = 1000, session = getDefaultReactiveDomain())
|
||||
}
|
||||
\arguments{
|
||||
\item{intervalMs}{How often to fire, in milliseconds}
|
||||
@@ -39,7 +39,7 @@ shinyServer(function(input, output, session) {
|
||||
|
||||
# Anything that calls autoInvalidate will automatically invalidate
|
||||
# every 2 seconds.
|
||||
autoInvalidate <- reactiveTimer(2000, session)
|
||||
autoInvalidate <- reactiveTimer(2000)
|
||||
|
||||
observe({
|
||||
# Invalidate and re-execute this reactive expression every time the
|
||||
|
||||
Reference in New Issue
Block a user