title: How can I attach a window resize event listener in JavaScript?
body: <p>I'm making a JS/PHP plugin for distribution. I want it to be as easy to install as this:</p>
  
  <pre><code>&lt;HTML&gt;
  &lt;HEAD&gt;
  &lt;TITLE&gt;Testing my Plugin&lt;/TITLE&gt;
  &lt;?php
    include 'path/to/myPlugin.php';
    echo getMyPluginHeadContent();
  ?&gt;
  &lt;/HEAD&gt;
  &lt;BODY&gt;
  &lt;?php
    echo getMyPluginContent("Arguments will go here");
  ?&gt;
  &lt;/BODY&gt;
  &lt;/HTML&gt;
  </code></pre>
  
  <p>However, I want this plugin to attach a window resize listener <strong>without</strong> overriding <code>window.onresize</code>, in case there are any other scripts that also require the use of that method. <strong>Is there any javascript command like <code>document.addEventListener("resize", myResizeMethod, true);</code>?</strong> I know that's not it, because that's not working, and the MDN and W3C are very vague about what arguments <code>addEventListener</code> takes.</p>
  
  <p><strong>I do not want an answer telling me to use <code>window.onresize = myResizeMethod</code> or <code>&lt;BODY ONRESIZE="myResizeMethod"&gt;</code>, as these are not as plugin-friendly.</strong></p>