Closed JohnCoene closed 4 years ago
Can now be done, see docs
library(shiny)
library(waiter)
ui <- fluidPage(
use_waiter(),
actionButton("draw", "draw plot"),
plotOutput("plot")
)
server <- function(input, output){
# sets:
# input$plot_waiter_shown
# input$plot_waiter_hidden
w <- Waiter$new(id = "plot")
dataset <- reactive({
input$draw
w$show()
on.exit({
w$hide()
})
Sys.sleep(3)
runif(100)
})
output$plot <- renderPlot(plot(dataset()))
observeEvent(input$plot_waiter_hidden, {
print(input$plot_waiter_hidden)
})
observeEvent(input$plot_waiter_shown, {
print(input$plot_waiter_shown)
})
}
shinyApp(ui, server)
Retrieve when waiter is shown or hidden as input.