Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>1) If the next page does not have any Knockout on it is it really that bad to leave the knockout object sort of just lingering in memory? Better yet is there a way to reset (clear) the knockout object?</p> </blockquote> <p>No, it's not that bad; but if you'd really like to clean up then you can call <a href="https://groups.google.com/d/msg/knockoutjs/cIwSL2JkyQU/NKXcdYvWdAcJ" rel="nofollow noreferrer"><code>ko.removeNode</code></a>.</p> <hr> <blockquote> <p>2) When I go from one page that has knockout bindings to another that has knockout bindings does just calling ko.applyBindings() again clear out the old stuff and rebind the new stuff? (once again when I say going from one page to another I am just reloading the body with an ajax call).</p> </blockquote> <p>It depends.</p> <p>First of all, as <a href="https://stackoverflow.com/questions/9853850/knockoutjs-memory-leak#comment14384828_9969819">GregT mentioned</a>:</p> <blockquote> <p>One should not call <code>applyBindings()</code> more than once on the same DOM node(s).</p> </blockquote> <p>I know from experience - Calling <code>ko.applyBindings()</code> more than once on the same DOM node <strong>will cause a memory leak</strong>. [If you need to do this, then call <a href="https://stackoverflow.com/a/10049722/109941"><code>ko.cleanNode()</code></a>.]</p> <p>OTOH, if you're not calling <code>ko.applyBindings()</code> more than once on the same DOM node, then you should be fine <a href="https://groups.google.com/d/msg/knockoutjs/cIwSL2JkyQU/lbLrPNspQTAJ" rel="nofollow noreferrer">because</a>:</p> <blockquote> <p>KO will do some cleanup when adding/removing nodes. The typical time that this happens is when re-rendering a template.</p> </blockquote> <hr> <blockquote> <p>3) Does knockout have any "live" bindings. Sort of like jQuery's live binding? This way Knockout could be loaded up front and then not have to be reapplied from content change to content change.</p> </blockquote> <p>Not that I know of, but if I understand your question correctly, you shouldn't need any native Knockout functionality to implement what you need. You should be able to wire it up yourself with jQuery's <a href="http://api.jquery.com/on/" rel="nofollow noreferrer"><code>on()</code></a> method (because <a href="http://api.jquery.com/live/" rel="nofollow noreferrer"><code>live()</code></a> has been deprecated).</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.
    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