title: Javascript : Uncaught TypeError: Illegal invocation
body: <p>Here <code>bundle.js</code> is bundled through <code>browserify</code> which includes a module called <code>webrtcsupport</code>   </p>
  
  <pre><code>&lt;script type="text/javascript" src="/assets/js/bundle.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      var webrtcSupport = require('webrtcsupport');
      console.log(webrtcSupport.getUserMedia);
      webrtcSupport.getUserMedia();
  &lt;/script&gt;
  </code></pre>
  
  <p>Output in browser(Chrome browser) console:</p>
  
  <pre><code>function webkitGetUserMedia() { [native code] }
  Uncaught TypeError: Illegal invocation
  </code></pre>
  
  <p>Why cant I invoke the above function in this manner and what is the right way of doing it?</p>