title: Shiny - Change color of actionButton while executing asynchronous task
body: <p>I have an asynchronous task, initiated by an actionButton, that starts a remote process which takes a long and unspecified time to execute. At the end of the process, a file is written in a remote server. Is there a way of changing the color of the actionButton while the task is executing and revert to the original color once it is detected that the remote file is written?</p>
  
  <p>Please note that a progress bar will not help, as I don't know how long the task will take (it may last from 30 seconds to 3 minutes, or longer). I need a binary process such as changing the color of the actionButton while the remote process is executing to warn the user not to press the button again (or, also, to disable the button until the file is written). In pseudo-code, this is how I envision the steps to proceed:</p>
  
  <pre><code>(1) actionButton color = 'green'
  
  (2) click actionButton --&gt; change color to 'red' (and disable button?)--&gt; start remote process asynchronously --&gt; may take 2 minutes --&gt; write file remotely
  
  (3) if(exists(file remote)){change actionButton color back to 'green' (and enable button?)}
  
  (4) use remote file
  </code></pre>
  
  <p>Please note that the key aspect here is that the remote process is <em>asynchronous</em>. In the more common processing for R files, lines (3) and (4) would run synchronously and a change of color in the actionButton would not be necessary as the program would wait for line (2) to end before continuing. In my case, currently, immediately after I run line (2), the process continues and doesn't wait for the remote file to be created and stored. However, I need the results stored in the remote file in further steps.</p>
  
  <p>Thanks</p>