Brilliant: I do not know how to stop one process started by a button by pressing another button

I need help with my Shiny app. I will try to simplify my question. My problem is that I am developing an application that creates a report when a button is clicked. This report takes 10 to 15 minutes. I would have another button (Stop button) that stops the previous process, but does not stop my application. To show this, I will show just the code that I can take as a link to solve my application. I would like the counting to begin by pressing the "count" button, it stops if I click the "Stop" button.

ui.R code:

shinyUI( fluidPage( actionButton("count","Start count"), actionButton("stop","Stop count") ) ) 

server.R code:

 shinyServer(function(input, output, session) { observeEvent(input$count, { observeEvent(input$stop, { # Code for stop counting }) i <- 1 for (i in i:10000) { print(paste("Number: ",i)) } }) }) 

Thanks a lot of friends!

+1
source share

All Articles