tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

reject-top-level-await.rst (597B)


      1 reject-top-level-await
      2 ======================
      3 
      4 Rejects ``await`` at the top-level of code in modules. Top-level ``await`` is
      5 not currently support in Gecko's component modules, so this is rejected.
      6 
      7 Examples of incorrect code for this rule:
      8 -----------------------------------------
      9 
     10 .. code-block:: js
     11 
     12    await foo;
     13 
     14    if (expr) {
     15      await foo;
     16    }
     17 
     18    for await (let x of [1, 2, 3]) { }
     19 
     20 Examples of correct code for this rule:
     21 ---------------------------------------
     22 
     23 .. code-block:: js
     24 
     25    async function() { await foo; }
     26    async function() { for await (let x of [1, 2, 3]) { } }