Is there any way to extend the amount of time a progress bar message is displayed? Say extend it so that it is posted for about 1.5 seconds?
you can use functionality from shinyIncubator
package. I set the sleep
for 1.5 seconds as per your example, so when the task is finished the message will remain visible for 1.5 seconds.
rm(list = ls())
library(shiny)
library(shinyIncubator)
server <- function(input, output, session) {
observe({
if(input$aButton==0) return(NULL)
withProgress(session, min=1, max=15, expr={
for(i in 1:10) {
setProgress(message = 'Finished...',detail = paste0('Number ',i, ':10'))
Sys.sleep(0.1)
}
Sys.sleep(1.5)
})
})
}
ui <- pageWithSidebar(
headerPanel("Testing"),
sidebarPanel(actionButton("aButton", "Let's go!"), width=2),
mainPanel(progressInit())
)
shinyApp(ui = ui, server = server)