title: Set Timeout in Google Apps Scripts
body: <p>Is it possible to call <a href="https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout" rel="noreferrer">setTimeout</a> or an equivalent function in Google Apps Scripts?</p>
  
  <p>When I try to run the following code:</p>
  
  <pre class="lang-js prettyprint-override"><code>function onSubmit() {
    // we've been called, remove trigger, set timeout, re-enable, and then run function
    destroySubmitHandler();
    setTimeout(function() {
      createSubmitHandler();
      myFunction()
    }, 5 * 1000)
  }
  </code></pre>
  
  <p>I get the following error:</p>
  
  <p><img src="https://i.imgur.com/SVy1CCx.png" alt="screenshot"></p>