title: How do I use requestAnimationFrame to call my js prototype?
body: <p>I want to call my methid animate indefinetely using requestAnimationFrame. However , the approach I am using does not seem to work.. Here are my codes ..</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8"&gt;
  
          &lt;script&gt;
  function object(){
      this.index = 0;
  }
  
  object.prototype.animate = function(){
      alert("vimak");
      window.webkitRequestAnimationFrame( self.animate);
  }
  me = new object();
  me.animate();
  
          &lt;/script&gt;
  
      &lt;/head&gt;
  
      &lt;body&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>it gives me the folowing error..
   Uncaught Error: TYPE_MISMATCH_ERR: DOM Exception 17</p>
  
  <p>How do I fix this ? </p>
  
  <p><strong>Edited version</strong></p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8"&gt;
  
          &lt;script&gt;
  function object(){
      this.index = 0;
  }
  
  object.prototype.animate = function(){
  
      var that = this;console.log(that);
      window.webkitRequestAnimationFrame( that.animate);
  }
  me = new object();
  me.animate();
  
          &lt;/script&gt;
  
      &lt;/head&gt;
  
      &lt;body&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The output is </p>
  
  <p>object
   requestAnimationFrame.html:12
  Window
   requestAnimationFrame.html:12
  Uncaught Error: TYPE_MISMATCH_ERR: DOM Exception 17 </p>
  
  <p>How do I make this work ?</p>