[Pkg-javascript-commits] [node-acorn-jsx] 61/484: Use 'self' instead of 'window' in browser, in order to work in a web worker

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:20:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-acorn-jsx.

commit f58bb9a4808873efac685e7c0d011d6d48a97d14
Author: Marijn Haverbeke <marijnh at gmail.com>
Date:   Thu Nov 29 10:08:32 2012 +0100

    Use 'self' instead of 'window' in browser, in order to work in a web worker
---
 acorn.js   | 4 ++--
 index.html | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/acorn.js b/acorn.js
index 80f0d99..64abf4b 100644
--- a/acorn.js
+++ b/acorn.js
@@ -18,7 +18,7 @@
 
   exports.version = "0.0.1";
 
-  // The main exported interface (under `window.acorn` when in the
+  // The main exported interface (under `self.acorn` when in the
   // browser) is a `parse` function that takes a code string and
   // returns an abstract syntax tree as specified by [Mozilla parser
   // API][api], with the caveat that the SpiderMonkey-specific syntax
@@ -1653,4 +1653,4 @@
     return finishNode(node, "Identifier");
   }
 
-})(typeof exports === "undefined" ? (window.acorn = {}) : exports);
+})(typeof exports === "undefined" ? (self.acorn = {}) : exports);
diff --git a/index.html b/index.html
index dbf10f3..b844133 100644
--- a/index.html
+++ b/index.html
@@ -13,7 +13,7 @@ https://github.com/marijnh/acorn.git
 <p>Please use the <a href="https://github.com/marijnh/acorn/issues">github bug tracker</a> to report issues.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">exports</span><span class="p">)</span> <span class="p">{</span>
   <span class="s2">"use strict"</span><span class="p">;</span>
 
-  <span class="nx">exports</span><span class="p">.</span><span class="nx">version</span> <span class="o">=</span> <span class="s2">"0.0.1"</span><span class="p">;</span></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">¶</a>               </div>               <p>The main exported interface (under <code>window. [...]
+  <span class="nx">exports</span><span class="p">.</span><span class="nx">version</span> <span class="o">=</span> <span class="s2">"0.0.1"</span><span class="p">;</span></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">¶</a>               </div>               <p>The main exported interface (under <code>self.ac [...]
 browser) is a <code>parse</code> function that takes a code string and
 returns an abstract syntax tree as specified by <a href="https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API">Mozilla parser
 API</a>, with the caveat that the SpiderMonkey-specific syntax
@@ -1236,6 +1236,6 @@ identifiers.</p>             </td>             <td class="code">               <
     <span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"Identifier"</span><span class="p">);</span>
   <span class="p">}</span>
 
-<span class="p">})(</span><span class="k">typeof</span> <span class="nx">exports</span> <span class="o">===</span> <span class="s2">"undefined"</span> <span class="o">?</span> <span class="p">(</span><span class="nb">window</span><span class="p">.</span><span class="nx">acorn</span> <span class="o">=</span> <span class="p">{})</span> <span class="o">:</span> <span class="nx">exports</span><span class="p">);</span>
+<span class="p">})(</span><span class="k">typeof</span> <span class="nx">exports</span> <span class="o">===</span> <span class="s2">"undefined"</span> <span class="o">?</span> <span class="p">(</span><span class="nx">self</span><span class="p">.</span><span class="nx">acorn</span> <span class="o">=</span> <span class="p">{})</span> <span class="o">:</span> <span class="nx">exports</span><span class="p">);</span>
 
 </pre></div>             </td>           </tr>                </tbody>     </table>   </div> </body> </html> 
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git



More information about the Pkg-javascript-commits mailing list