# ui.R
library(shiny)
shinyUI(fluidPage(
 singleton(tags$head(HTML(
  '
  <script type="text/javascript">
  $(document).ready(function() {
  Â
  // disable start_proc button after a click
  Shiny.addCustomMessageHandler("disableButton", function(message) {
  $("#start_proc").attr("disabled", "true");
  });
  Â
  // Enable start_proc button when computation is finished
  Shiny.addCustomMessageHandler("enableButton", function(message) {
  $("#start_proc").removeAttr("disabled");
  });
})
  </script>
  '
))),
 tabsetPanel(
  tabPanel('Enable/Disable Start Button',
   actionButton("start_proc", h5("Start Button")),
   hr(),
   helpText("Start Button will be available once the computation (5 seconds) is completed.")
  )
 )
))
# server.R
library(shiny)
fakeDataProcessing <- function(duration) {
 # does nothing but sleep for "duration" seconds while
 # pretending some background task is going on...
 Sys.sleep(duration)
}
shinyServer(function(input, output, session) {
 Â
 observe({
  if (input$start_proc > 0) {
   # Notify the browser that the computation is running
   session$sendCustomMessage("disableButton", "start_proc")
   print("Computation is running.")
   fakeDataProcessing(5)
   # Notify the browser that the computation is finished
   session$sendCustomMessage("enableButton", "start_proc")
   print("Computation is done.")
  }
 })
})
Can anybody tell me how to print my messages "Computation is running." and "Computation is done." in a textOutput in real time ?