Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

321 lines (319 sloc) 9.815 kb
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<title>CoffeeScript API Documentation</title>
<link rel='stylesheet' href='../assets/codo.css' type='text/css'>
<script src='../assets/codo.js'></script>
<script src='../assets/search_data.js'></script>
</head>
<body>
<div id='base' data-path='../'></div>
<div id='header'>
<div id='menu'>
<a href='../class_index.html' title='Index'>Index</a>
&raquo;
<span class='title'>kb</span>
<nav>
<ul>
<li class='noframes'>
(<a class='noframes' href='#'>no frames</a>)
</li>
</ul>
</nav>
<div id='search'>
<a id='class_list_link' href='../class_list.html'>Classes</a>
<a id='method_list_link' href='../method_list.html'>Methods</a>
<a id='extra_list_link' href='../extra_list.html'>Extras</a>
</div>
</div>
<iframe id='search_frame'></iframe>
<div id='fuzzySearch'>
<input type='text'>
<ol></ol>
</div>
<div id='help'>
<p>
Quickly fuzzy find classes, mixins, methods, file:
</p>
<ul>
<li>
<span>Ctrl-T</span>
Open fuzzy finder dialog
</li>
</ul>
<p>
In frame mode you can toggle the list naviation frame on the left side:
</p>
<ul>
<li>
<span>Ctrl-L</span>
Toggle list view
</li>
</ul>
<p>
You can focus a list in frame mode or toggle a tab in frameless mode:
</p>
<ul>
<li>
<span>Ctrl-C</span>
Class list
</li>
<li>
<span>Ctrl-I</span>
Mixin list
</li>
<li>
<span>Ctrl-F</span>
File list
</li>
<li>
<span>Ctrl-M</span>
Method list
</li>
<li>
<span>Ctrl-E</span>
Extras list
</li>
</ul>
<p>
You can focus and blur the search input:
</p>
<ul>
<li>
<span>Ctrl-S</span>
Focus search input
</li>
<li>
<span>Esc</span>
Blur search input
</li>
</ul>
<p>
In frameless mode you can close the list tab:
</p>
<ul>
<li>
<span>Esc</span>
Close list tab
</li>
</ul>
</div>
</div>
<div id='content'>
<h1>
Class:
kb
</h1>
<table class='box'>
<tr>
<td>Defined in:</td>
<td>src/knockback-core/knockback-core.coffee</td>
</tr>
</table>
<h2>Overview</h2>
<div class='docstring'>
<p>knockback.js 0.16.1 (c) 2011, 2012 Kevin Malakoff. Knockback.js is freely distributable under the MIT license. See the following for full license details: <a href="https://github.com/kmalakoff/knockback/blob/master/LICENSE">https://github.com/kmalakoff/knockback/blob/master/LICENSE</a> Dependencies: Knockout.js, Backbone.js, and Underscore.js. </p>
</div>
<div class='tags'>
</div>
<h2>Constant Summary</h2>
<dl class='constants'>
<dt id='VERSION-constant'>
VERSION
=
<div class='tags'>
</div>
</dt>
<dd>
<pre><code class='coffee'>'0.16.1'</code></pre>
</dd>
</dl>
<h2>Class Method Summary</h2>
<ul class='summary'>
<li>
<span class='signature'>
<a href='#release-class'>
+ (void) <strong>release</strong>(obj, pre_release_fn)
</a>
</span>
<span class='desc'>
Releases any type of view model or observable or items in an array using the conventions of release(), destroy(), dispose().
</span>
</li>
<li>
<span class='signature'>
<a href='#releaseKeys-class'>
+ (void) <strong>releaseKeys</strong>(obj)
</a>
</span>
<span class='desc'>
Releases and clears all of the keys on an object using the conventions of release(), destroy(), dispose() without releasing the top level object itself.
</span>
</li>
<li>
<span class='signature'>
<a href='#releaseOnNodeRemove-class'>
+ (void) <strong>releaseOnNodeRemove</strong>(view_model, node)
</a>
</span>
<span class='desc'>
Binds a callback to the node that releases the view model when the node is removed using ko.removeNode.
</span>
</li>
<li>
<span class='signature'>
<a href='#renderAutoReleasedTemplate-class'>
+ (void) <strong>renderAutoReleasedTemplate</strong>(template, view_model, options = {})
</a>
</span>
<span class='desc'>
Renders a template and binds a callback to the node that releases the view model when the node is removed using ko.removeNode.
</span>
</li>
<li>
<span class='signature'>
<a href='#applyBindings-class'>
+ (void) <strong>applyBindings</strong>(view_model, node)
</a>
</span>
<span class='desc'>
Applies bindings and binds a callback to the node that releases the view model when the node is removed using ko.removeNode.
</span>
</li>
</ul>
<h2>Class Method Details</h2>
<div class='methods'>
<div class='method_details'>
<p class='signature' id='release-class'>
+ (void) <strong>release</strong>(obj, pre_release_fn)
</p>
<div class='docstring'>
<p>Releases any type of view model or observable or items in an array using the conventions of release(), destroy(), dispose(). </p>
<div class='examples'>
<h3>Examples:</h3>
<h4>
</h4>
<pre><code class='coffee'>var view_model = kb.viewModel(model);
kb.utils.release(view_model); view_model = null;</code></pre>
<h4>
</h4>
<pre><code class='coffee'>var todos = kb.collectionObservable(collection);
kb.utils.release(todos); todos = null;
</code></pre>
</div>
</div>
<div class='tags'>
<h3>Parameters:</h3>
<ul class='param'>
<li>
<span class='name'>obj</span>
<span class='type'>
(<tt>Any</tt>)
</span>
&mdash;
<span class='desc'>the object to release and also release its keys</span>
</li>
<li>
<span class='name'>pre_release_fn</span>
<span class='type'>
(<tt>Function</tt>)
</span>
&mdash;
<span class='desc'>an optional function to clear the key on the object before the key's value is released. Used by kb.releaseKeys.</span>
</li>
</ul>
</div>
</div>
<div class='method_details'>
<p class='signature' id='releaseKeys-class'>
+ (void) <strong>releaseKeys</strong>(obj)
</p>
<div class='docstring'>
<p>Releases and clears all of the keys on an object using the conventions of release(), destroy(), dispose() without releasing the top level object itself. </p>
</div>
<div class='tags'>
</div>
</div>
<div class='method_details'>
<p class='signature' id='releaseOnNodeRemove-class'>
+ (void) <strong>releaseOnNodeRemove</strong>(view_model, node)
</p>
<div class='docstring'>
<p>Binds a callback to the node that releases the view model when the node is removed using ko.removeNode. </p> <pre><code>ko.utils.domNodeDisposal.addDisposeCallback(node, function() { kb.release(view_model)} );</code></pre>
<div class='examples'>
<h3>Examples:</h3>
<h4>
The hard way to set up automatic calling of 'kb.release(view_model)' when the bound element is released.
</h4>
<pre><code class='coffee'>var el = $(&#39;&lt;div data-bind=&quot;name: name&quot;&gt;&lt;/div&gt;&#39;)[0];
var view_model = kb.viewModel(new Backbone.Model({name: &#39;Bob&#39;}));
ko.applyBindings(view_model, el);
kb.releaseOnNodeRemove(view_model, el);
...
ko.removeNode(el); // removes el from the DOM and calls kb.release(view_model)
</code></pre>
</div>
</div>
<div class='tags'>
</div>
</div>
<div class='method_details'>
<p class='signature' id='renderAutoReleasedTemplate-class'>
+ (void) <strong>renderAutoReleasedTemplate</strong>(template, view_model, options = {})
</p>
<div class='docstring'>
<p>Renders a template and binds a callback to the node that releases the view model when the node is removed using ko.removeNode. </p>
<div class='examples'>
<h3>Examples:</h3>
<h4>
The easy way to set up automatic calling of 'kb.release(view_model)' when the bound element is released.
</h4>
<pre><code class='coffee'>var el = kb.renderAutoReleasedTemplate(&#39;my_template&#39;, kb.viewModel(new Backbone.Model({name: &#39;Bob&#39;})));
...
ko.removeNode(el); // removes el from the DOM and calls kb.release(view_model)
</code></pre>
</div>
</div>
<div class='tags'>
</div>
</div>
<div class='method_details'>
<p class='signature' id='applyBindings-class'>
+ (void) <strong>applyBindings</strong>(view_model, node)
</p>
<div class='docstring'>
<p>Applies bindings and binds a callback to the node that releases the view model when the node is removed using ko.removeNode. </p>
<div class='examples'>
<h3>Examples:</h3>
<h4>
The easy way to set up automatic calling of 'kb.release(view_model)' when the bound element is released.
</h4>
<pre><code class='coffee'>var el = $(&#39;&lt;div data-bind=&quot;name: name&quot;&gt;&lt;/div&gt;&#39;)[0];
kb.applyBindings(kb.viewModel(new Backbone.Model({name: &#39;Bob&#39;})), el);
...
ko.removeNode(el); // removes el from the DOM and calls kb.release(view_model)
</code></pre>
</div>
</div>
<div class='tags'>
</div>
</div>
</div>
</div>
<div id='footer'>
Generated on
Thu Sep 06 2012 17:22:43 GMT+0900 (JST)
by
<a href='https://github.com/netzpirat/codo' title='CoffeeScript API documentation generator'>Codo</a>
v1.3.0
(Node.js v0.8.7).
&#10034;
Press Ctrl-h to see the keyboard shortcuts
&#10034;
<a href='http://twitter.com/#!/netzpirat'>@netzpirat</a>
&#10034;
<a href='https://mksoft.ch'>mksoft.ch</a>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.