Reputation: 11
Im new to shiny R...Here is my code...
ui.R
library(shiny)
fluidPage(mainPanel(actionButton("run","RUN")))
server.R
function(input, output) {
observeEvent(input$run,{
print("Start")
Sys.sleep(2)
print("End")})
}
The problem is ...when i press run before console prints previous "end"....it starts executing observeEvent again as soon previous observeEvent ends...is there any way to stop pipelining of observeEvent queue?????
all i want is to stop user interactions on 'run' button while function is already in execution...
Upvotes: 0
Views: 1719
Reputation: 11
After a bit of search i finally got solution ....which solved my purpose....
ui.R
library(shiny)
library(shinyjs)
fluidPage(shinyjs::useShinyjs(),mainPanel(actionButton("run","RUN")))
server.R
function(input, output) {
observeEvent(input$run,{
shinyjs::disable("run")
print("Start")
Sys.sleep(2)
print("End")
shinyjs::enable("run")})
}
Upvotes: 1