title: js - check if a function is completed
body: <p>I want to set a hotkey to several functions by jquery hotkeys. And I need to check if a function is finished, may be something like:</p>
  
  <pre><code>if("function A is completed")
  {
      "Ctrl+A is now set to function B"
  }
  else
  {
      "Ctrl+A is set to function A"
  }
  </code></pre>
  
  <p>How could I check this? Or any better ideas?</p>