title: Disable button in shiny while plot is loading
body: <p>Is it possible to disable a button in shiny while a plot / a reactive element is loading? I know <code>shinyjs</code> can disable and enable input elements, but I don't know how to set up the connection to a loading plot / reactive element. The example is based on the <a href="https://shiny.rstudio.com/articles/single-file.html" rel="noreferrer">Single-file shiny apps page</a>. I just added a button and the isolated part. Solutions that are not based on <code>shinyjs</code> are also appreciated :)</p>
  
  <pre><code>library(shiny)
  server &lt;- function(input, output) {
    output$distPlot &lt;- renderPlot({
      input$button
  
      isolate(
        hist(rnorm(input$obs), col = 'darkgray', border = 'white')
      )
    })
  }
  
  ui &lt;- fluidPage(
    shinyjs::useShinyjs(),
    sidebarLayout(
      sidebarPanel(
        sliderInput("obs", "Number of observations:", min = 10, max = 500, value = 100),
        actionButton("button", "OK!")
      ),
      mainPanel(plotOutput("distPlot"))
    )
  )
  
  shinyApp(ui = ui, server = server)
  </code></pre>