title: get owning object of a function javascript
body: <p>This is more of a general question. I have seen some answers related to it before but none gave me a clear answer.</p>
  
  <p>I want to achieve an auto binding function.</p>
  
  <p>example:</p>
  
  <pre><code>var someObject;
  var handle = function(arg1, callback){
     someObject(arg1, callback.bind(???owner of callback???))
  }
  
  var handler = new Handler();    
  
  //Calling it
  handle("my arg", handler.handlerFunction);
  </code></pre>
  
  <p>I'm not able to control the someObject way of calling the callback as it is a third party library and it is calling my callback with a reference to itself, so I can't use this inside my prototype definitions.</p>
  
  <p>I can easily achieve this by using an extra argument to the handle function sending in handler and binding to it.</p>
  
  <p>Or wrapping the handler.handleFunction into an apply block, but I think it would look much better if I could just call it the way I referred to to in the codeblock.</p>
  
  <p>Is it possible to find the reference to the object owning handlerFunction?</p>
  
  <p>I'm using Nodejs, if that has any relevance.</p>