Skip to content

Instantly share code, notes, and snippets.

@ponelat
Created January 26, 2022 16:32
Show Gist options
  • Save ponelat/ea2cc81248e0c6012fa61df731ca2df6 to your computer and use it in GitHub Desktop.
Save ponelat/ea2cc81248e0c6012fa61df731ca2df6 to your computer and use it in GitHub Desktop.
morearty-binding.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Binding</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: Binding</h1>
<section>
<header>
<h2>Binding</h2>
<div class="class-description">Wraps immutable collection. Provides convenient read-write access to nested values.
Allows to create sub-bindings (or views) narrowed to a subpath and sharing the same backing value.
Changes to these bindings are mutually visible.
<p>Terminology:
<ul>
<li>
(sub)path - path to a value within nested associative data structure, example: 'path.t.0.some.value';
</li>
<li>
backing value - value shared by all bindings created using <a href="Binding.html#sub">sub</a> method.
</li>
</ul>
<p>Features:
<ul>
<li>can create sub-bindings sharing same backing value. Sub-binding can only modify values down its subpath;</li>
<li>allows to conveniently modify nested values: assign, update with a function, remove, and so on;</li>
<li>can attach change listeners to a specific subpath;</li>
<li>can perform multiple changes atomically in respect of listener notification.</li>
</ul></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="Binding"><span class="type-signature"></span>new Binding<span class="signature">(path<span class="signature-attributes">opt</span>, sharedInternals<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Binding constructor.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>path</code></td>
<td class="type">
<span class="param-type">Array.&lt;String></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">binding path, empty array if omitted</td>
</tr>
<tr>
<td class="name"><code>sharedInternals</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">shared relative bindings internals:
<ul>
<li>backingValue - backing value;</li>
<li>metaBinding - meta binding;</li>
<li>metaBindingListenerId - meta binding listener id;</li>
<li>listeners - change listeners;</li>
<li>cache - bindings cache.</li>
</ul></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line258">line 258</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="Binding.html#.init">Binding.init</a></li>
</ul>
</dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id=".META_NODE"><span class="type-signature">(static) </span>META_NODE<span class="type-signature"> :String</span></h4>
<div class="description">
Meta node name.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">String</span>
</li>
</ul>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li>Use Util.META_NODE instead.</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line345">line 345</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".asArrayPath"><span class="type-signature">(static) </span>asArrayPath<span class="signature">(pathAsString)</span><span class="type-signature"> &rarr; {Array}</span></h4>
<div class="description">
Convert string path to array path.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>pathAsString</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">path as string</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line331">line 331</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
path as an array
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id=".asStringPath"><span class="type-signature">(static) </span>asStringPath<span class="signature">(pathAsAnArray)</span><span class="type-signature"> &rarr; {String}</span></h4>
<div class="description">
Convert array path to string path.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>pathAsAnArray</code></td>
<td class="type">
<span class="param-type">Array.&lt;String></span>
</td>
<td class="description last">path as an array</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line338">line 338</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
path as a string
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
<h4 class="name" id=".init"><span class="type-signature">(static) </span>init<span class="signature">(backingValue<span class="signature-attributes">opt</span>, metaBinding<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="Binding.html">Binding</a>}</span></h4>
<div class="description">
Create new binding with empty listeners set.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>backingValue</code></td>
<td class="type">
<span class="param-type">Immutable.Map</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">backing value, empty map if omitted</td>
</tr>
<tr>
<td class="name"><code>metaBinding</code></td>
<td class="type">
<span class="param-type"><a href="Binding.html">Binding</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">meta binding</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line315">line 315</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
fresh binding instance
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Binding.html">Binding</a></span>
</dd>
</dl>
<h4 class="name" id="addListener"><span class="type-signature"></span>addListener<span class="signature">(subpath<span class="signature-attributes">opt</span>, cb)</span><span class="type-signature"> &rarr; {String}</span></h4>
<div class="description">
Add change listener.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>subpath</code></td>
<td class="type">
<span class="param-type">String</span>
|
<span class="param-type">Array</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">subpath as a dot-separated string or an array of strings and numbers</td>
</tr>
<tr>
<td class="name"><code>cb</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last">function receiving changes descriptor</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line507">line 507</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="ChangesDescriptor.html">ChangesDescriptor</a></li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
unique id which should be used to un-register the listener
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
<h4 class="name" id="addOnceListener"><span class="type-signature"></span>addOnceListener<span class="signature">(subpath<span class="signature-attributes">opt</span>, cb)</span><span class="type-signature"> &rarr; {String}</span></h4>
<div class="description">
Add change listener triggered only once.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>subpath</code></td>
<td class="type">
<span class="param-type">String</span>
|
<span class="param-type">Array</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">subpath as a dot-separated string or an array of strings and numbers</td>
</tr>
<tr>
<td class="name"><code>cb</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last">function receiving changes descriptor</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line531">line 531</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="ChangesDescriptor.html">ChangesDescriptor</a></li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
unique id which should be used to un-register the listener
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
<h4 class="name" id="atomically"><span class="type-signature"></span>atomically<span class="signature">(promise<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="TransactionContext.html">TransactionContext</a>}</span></h4>
<div class="description">
Create transaction context.
If promise is supplied, transaction will be automatically
cancelled and reverted (if already committed) on promise failure.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>promise</code></td>
<td class="type">
<span class="param-type">Promise</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">ES6 promise</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line589">line 589</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
transaction context
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="TransactionContext.html">TransactionContext</a></span>
</dd>
</dl>
<h4 class="name" id="clear"><span class="type-signature"></span>clear<span class="signature">(subpath<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="Binding.html">Binding</a>}</span></h4>
<div class="description">
Clear nested collection. Does '.clear()' on Immutable values, nullifies otherwise.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>subpath</code></td>
<td class="type">
<span class="param-type">String</span>
|
<span class="param-type">Array</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">subpath as a dot-separated string or an array of strings and numbers</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line494">line 494</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
this binding
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Binding.html">Binding</a></span>
</dd>
</dl>
<h4 class="name" id="disableListener"><span class="type-signature"></span>disableListener<span class="signature">(listenerId)</span><span class="type-signature"> &rarr; {<a href="Binding.html">Binding</a>}</span></h4>
<div class="description">
Disable listener.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>listenerId</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">listener id</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line555">line 555</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
this binding
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Binding.html">Binding</a></span>
</dd>
</dl>
<h4 class="name" id="enableListener"><span class="type-signature"></span>enableListener<span class="signature">(listenerId)</span><span class="type-signature"> &rarr; {<a href="Binding.html">Binding</a>}</span></h4>
<div class="description">
Enable listener.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>listenerId</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">listener id</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line547">line 547</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
this binding
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Binding.html">Binding</a></span>
</dd>
</dl>
<h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(subpath<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></h4>
<div class="description">
Get binding value.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>subpath</code></td>
<td class="type">
<span class="param-type">String</span>
|
<span class="param-type">Array</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">subpath as a dot-separated string or an array of strings and numbers</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line413">line 413</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
value at path or null
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id="getPath"><span class="type-signature"></span>getPath<span class="signature">()</span><span class="type-signature"> &rarr; {Array}</span></h4>
<div class="description">
Get binding path.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line352">line 352</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
binding path
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="isChanged"><span class="type-signature"></span>isChanged<span class="signature">(alternativeBackingValue, compare<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Check if binding value is changed in alternative backing value.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>alternativeBackingValue</code></td>
<td class="type">
<span class="param-type">Immutable.Map</span>
</td>
<td class="attributes">
</td>
<td class="description last">alternative backing value</td>
</tr>
<tr>
<td class="name"><code>compare</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">alternative compare function, does reference equality check if omitted</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line369">line 369</a>
</li></ul></dd>
</dl>
<h4 class="name" id="isRelative"><span class="type-signature"></span>isRelative<span class="signature">(otherBinding)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
Check if this and supplied binding are relatives (i.e. share same backing value).
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>otherBinding</code></td>
<td class="type">
<span class="param-type"><a href="Binding.html">Binding</a></span>
</td>
<td class="description last">potential relative</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line380">line 380</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id="merge"><span class="type-signature"></span>merge<span class="signature">(subpath<span class="signature-attributes">opt</span>, preserve<span class="signature-attributes">opt</span>, newValue)</span><span class="type-signature"> &rarr; {<a href="Binding.html">Binding</a>}</span></h4>
<div class="description">
Deep merge values.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>subpath</code></td>
<td class="type">
<span class="param-type">String</span>
|
<span class="param-type">Array</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last">subpath as a dot-separated string or an array of strings and numbers</td>
</tr>
<tr>
<td class="name"><code>preserve</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last">preserve existing values when merging</td>
</tr>
<tr>
<td class="name"><code>newValue</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">new value</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line480">line 480</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
this binding
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Binding.html">Binding</a></span>
</dd>
</dl>
<h4 class="name" id="meta"><span class="type-signature"></span>meta<span class="signature">(subpath<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="Binding.html">Binding</a>}</span></h4>
<div class="description">
Get binding's meta binding.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>subpath</code></td>
<td class="type">
<span class="param-type">String</span>
|
<span class="param-type">Array</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">subpath as a dot-separated string or an array of strings and numbers;
b.meta('path') is equivalent to b.meta().sub('path')</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line389">line 389</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
meta binding or undefined
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Binding.html">Binding</a></span>
</dd>
</dl>
<h4 class="name" id="remove"><span class="type-signature"></span>remove<span class="signature">(subpath<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="Binding.html">Binding</a>}</span></h4>
<div class="description">
Delete value.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>subpath</code></td>
<td class="type">
<span class="param-type">String</span>
|
<span class="param-type">Array</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">subpath as a dot-separated string or an array of strings and numbers</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line470">line 470</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
this binding
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Binding.html">Binding</a></span>
</dd>
</dl>
<h4 class="name" id="removeListener"><span class="type-signature"></span>removeListener<span class="signature">(listenerId)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
Un-register the listener.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>listenerId</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">listener id</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line579">line 579</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
true if listener removed successfully, false otherwise
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id="set"><span class="type-signature"></span>set<span class="signature">(subpath<span class="signature-attributes">opt</span>, newValue)</span><span class="type-signature"> &rarr; {<a href="Binding.html">Binding</a>}</span></h4>
<div class="description">
Set binding value.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>subpath</code></td>
<td class="type">
<span class="param-type">String</span>
|
<span class="param-type">Array</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">subpath as a dot-separated string or an array of strings and numbers</td>
</tr>
<tr>
<td class="name"><code>newValue</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="attributes">
</td>
<td class="description last">new value</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line461">line 461</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
this binding
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Binding.html">Binding</a></span>
</dd>
</dl>
<h4 class="name" id="sub"><span class="type-signature"></span>sub<span class="signature">(subpath<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="Binding.html">Binding</a>}</span></h4>
<div class="description">
Bind to subpath. Both bindings share the same backing value. Changes are mutually visible.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>subpath</code></td>
<td class="type">
<span class="param-type">String</span>
|
<span class="param-type">Array</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">subpath as a dot-separated string or an array of strings and numbers</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line428">line 428</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
new binding instance, original is unaffected
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Binding.html">Binding</a></span>
</dd>
</dl>
<h4 class="name" id="toJS"><span class="type-signature"></span>toJS<span class="signature">(subpath<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></h4>
<div class="description">
Convert to JS representation.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>subpath</code></td>
<td class="type">
<span class="param-type">String</span>
|
<span class="param-type">Array</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">subpath as a dot-separated string or an array of strings and numbers</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line420">line 420</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
JS representation of data at subpath
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id="unlinkMeta"><span class="type-signature"></span>unlinkMeta<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
Unlink this binding's meta binding, removing change listener and making them totally independent.
May be used to prevent memory leaks when appropriate.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line405">line 405</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
true if binding's meta binding was unlinked
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id="update"><span class="type-signature"></span>update<span class="signature">(subpath<span class="signature-attributes">opt</span>, f)</span><span class="type-signature"> &rarr; {<a href="Binding.html">Binding</a>}</span></h4>
<div class="description">
Update binding value.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>subpath</code></td>
<td class="type">
<span class="param-type">String</span>
|
<span class="param-type">Array</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">subpath as a dot-separated string or an array of strings and numbers</td>
</tr>
<tr>
<td class="name"><code>f</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last">update function</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line451">line 451</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
this binding
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Binding.html">Binding</a></span>
</dd>
</dl>
<h4 class="name" id="withBackingValue"><span class="type-signature"></span>withBackingValue<span class="signature">(newBackingValue)</span><span class="type-signature"> &rarr; {<a href="Binding.html">Binding</a>}</span></h4>
<div class="description">
Update backing value.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>newBackingValue</code></td>
<td class="type">
<span class="param-type">Immutable.Map</span>
</td>
<td class="description last">new backing value</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line359">line 359</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
new binding instance, original is unaffected
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Binding.html">Binding</a></span>
</dd>
</dl>
<h4 class="name" id="withDisabledListener"><span class="type-signature"></span>withDisabledListener<span class="signature">(listenerId, f)</span><span class="type-signature"> &rarr; {<a href="Binding.html">Binding</a>}</span></h4>
<div class="description">
Execute function with listener temporarily disabled. Correctly handles functions returning promises.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>listenerId</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">listener id</td>
</tr>
<tr>
<td class="name"><code>f</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">function to execute</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Binding.js.html">Binding.js</a>, <a href="Binding.js.html#line564">line 564</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
this binding
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Binding.html">Binding</a></span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Binding.html">Binding</a></li><li><a href="ChangesDescriptor.html">ChangesDescriptor</a></li><li><a href="Context.html">Context</a></li><li><a href="TransactionContext.html">TransactionContext</a></li></ul><h3>Namespaces</h3><ul><li><a href="Callback.html">Callback</a></li><li><a href="DOM.html">DOM</a></li><li><a href="History.html">History</a></li><li><a href="Morearty.html">Morearty</a></li><li><a href="Morearty.Mixin.html">Mixin</a></li><li><a href="Util.html">Util</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Tue Jun 28 2016 12:47:04 GMT-0700 (PDT)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment