How can we use javascript await operator in the browser adding just a third party library? -


how use javascript await operator in browser using external javascript library?

for example, if have following html code:

<!doctype html> <html>     <head>         <script type='text/javascript' src='awesome.lib.js'></script>         <script type='text/javascript'>             async function slow() {                 return new promise(function(resolve, reject) {                   settimeout(function() {                       console.log("slow finished");                       resolve();                   }, 3000);                 });             }              function fast() {                 console.log("fast");             }              async function run() {                 await slow();                 fast();             }              run();         </script>     </head>     <body>     </body> </html> 

which libraries can use (where awesome.lib.js these libraries) bring await operator browser? how can code working example?

i know can transpile code, i'm searching clever solution can add third party library , voilá, works!

if using google traceur transpiler can transpile code (http://jsfiddle.net/msfrisbie/yk6r7gxr/) , code looks 1 below. problem need transpile code first. thing avoid using things not javascript <script type='text/whatevernotjavascript'>...code...code</script>. how can this? awesome, util , savior.

<script type="text/javscript">     $traceurruntime.modulestore.getanonymousmodule(function(require) {       "use strict";       var $__1 = $traceurruntime.inittailrecursivefunction(slow),           $__3 = $traceurruntime.inittailrecursivefunction(run);       function slow() {         return $traceurruntime.call(function() {           return $traceurruntime.continuation($traceurruntime.asyncwrap, $traceurruntime, [$traceurruntime.inittailrecursivefunction(function($ctx) {             return $traceurruntime.call(function($ctx) {               while (true)                 switch ($ctx.state) {                   case 0:                     $ctx.returnvalue = new promise(function(resolve, reject) {                       settimeout(function() {                         console.log("slow finished");                         resolve();                       }, 3000);                     });                     $ctx.state = 2;                     break;                   case 2:                     $ctx.state = -2;                     break;                   default:                     return $traceurruntime.continuation($ctx.end, $ctx, []);                 }             }, this, arguments);           }), this]);         }, this, arguments);       }       function fast() {         console.log("fast");       }       function run() {         return $traceurruntime.call(function() {           return $traceurruntime.continuation($traceurruntime.asyncwrap, $traceurruntime, [$traceurruntime.inittailrecursivefunction(function($ctx) {             return $traceurruntime.call(function($ctx) {               while (true)                 switch ($ctx.state) {                   case 0:                     promise.resolve(slow()).then($ctx.createcallback(2), $ctx.errback);                     return;                   case 2:                     fast();                     $ctx.state = -2;                     break;                   default:                     return $traceurruntime.continuation($ctx.end, $ctx, []);                 }             }, this, arguments);           }), this]);         }, this, arguments);       }       run();       return {};     });     //# sourceurl=traceured.js