title: How to trick Chrome's native async/await to play along angularjs (1.x)
body: <p>For quite a while I've been able to successfully use async/await syntax with Babel transpilation and an AngularJS (1.x) framework. The common problem is that async/await uses native Promises as opposed to angular's <code>$q</code> so async stuff runs outside of the digest loop.</p>
  
  <p>I hacked this by doing the following:</p>
  
  <pre><code>angular.module('app', []).run(($window, $q) =&gt; {
       $window.Promise = $q;
  });
  </code></pre>
  
  <p>I know that this is dangerous for a multitude of reasons but works like a charm without any wrappers like <code>$async</code> library that is not a drop-in solution (and I want a drop-in solution). </p>
  
  <p>Anyway it works great until I transpile the source code that generates JS that calls the actual <code>Promise</code> constructors etc. But this is a nightmare for debugging as even with source-maps the Chrome debugger often gets lost. But Chrome supports async/await for a while now and debugging those statements works perfectly. But when I edit my babel config not to transpile async/awaits then my <code>window.Promise</code> stops working because V8 must use it's internal Promise constructor when executing those async/await statements.</p>
  
  <p>Question is - is there a way to hack it to make it work with my current setup? I'm willing to dig into V8, compile my own chromium etc. Because after all I will still be transpiling async/awaits when making production builds - I just need it to work natively in local environment for debugging purposes.</p>
  
  <p>Any ideas?</p>