Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>this.pretendRender</code> is just a reference/pointer to a function, the context of <code>this</code> when the function is called depends on many things:</p> <pre><code>a.b.c = this.pretendRender; a.b.c(); </code></pre> <p><code>this</code> will be <code>b</code> inside <code>c</code> because the function referenced by <code>c</code> is being called as a property of <code>b</code></p> <hr> <pre><code>window.a = this.pretendRender; a(); </code></pre> <p><code>this</code> will be set to the <code>global object</code> because the function referenced by <code>a</code> is being called as a property of the <code>global object</code></p> <hr> <pre><code>a.b.c = this.pretendRender.bind( this ); a.b.c(); </code></pre> <p><code>this</code> will be the original <code>this</code> inside <code>c</code> no matter what because the function referenced by <code>c</code> is a bound function that calls the original function with context set to the original <code>this</code>. <code>.bind</code> exists in modern browsers but <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind#Compatibility" rel="nofollow">must be included to be sure</a> it's available.</p> <hr> <pre><code>a.b.c = this.pretendRender; a.b.c.call( someObject ); </code></pre> <p><code>this</code> will be <code>someObject</code> inside <code>c</code> because it is explicitly given.</p> <hr> <p>Since you are using jQuery, instead of <code>this.pretendRender.bind( this );</code> you can use <code>successCallback: $.proxy( this.pretendRender, this )</code></p> <p><a href="http://jsfiddle.net/AkZZr/8/" rel="nofollow">jsfiddle</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload