mirror of
https://github.com/wahyd4/Libr-mobile.git
synced 2026-08-26 05:06:09 +10:00
555 lines
11 KiB
HTML
555 lines
11 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>JSDoc: Module: $resolve</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">Module: $resolve</h1>
|
|
|
|
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<header>
|
|
<h2>
|
|
$resolve
|
|
</h2>
|
|
|
|
</header>
|
|
|
|
<article>
|
|
<div class="container-overview">
|
|
|
|
|
|
|
|
|
|
<div class="description"><p>Service (<code>ui-util</code>). Manages resolution of (acyclic) graphs of promises.</p></div>
|
|
|
|
|
|
|
|
<dl class="details">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<dt class="tag-source">Source:</dt>
|
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
<a href="resolve.js.html">resolve.js</a>, <a href="resolve.js.html#line1">line 1</a>
|
|
</li></ul></dd>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 class="subsection-title">Requires</h3>
|
|
|
|
<ul>
|
|
<li>module:$q</li>
|
|
|
|
<li>module:$injector</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 class="subsection-title">Methods</h3>
|
|
|
|
<dl>
|
|
|
|
<dt>
|
|
<h4 class="name" id="resolve"><span class="type-signature"></span>resolve<span class="signature">(invocables, <span class="optional">locals</span>, <span class="optional">parent</span>, <span class="optional">self</span>)</span><span class="type-signature"> → {Promise.<Object>}</span></h4>
|
|
|
|
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
<div class="description">
|
|
<p>Resolves a set of invocables. An invocable is a function to be invoked via <code>$injector.invoke()</code>,
|
|
and can have an arbitrary number of dependencies. An invocable can either return a value directly,
|
|
or a <code>$q</code> promise. If a promise is returned it will be resolved and the resulting value will be
|
|
used instead. Dependencies of invocables are resolved (in this order of precedence)</p>
|
|
<ul>
|
|
<li>from the specified <code>locals</code></li>
|
|
<li>from another invocable that is part of this <code>$resolve</code> call</li>
|
|
<li>from an invocable that is inherited from a <code>parent</code> call to <code>$resolve</code> (or recursively
|
|
from any ancestor <code>$resolve</code> of that parent).</li>
|
|
</ul>
|
|
<p>The return value of <code>$resolve</code> is a promise for an object that contains (in this order of precedence)</p>
|
|
<ul>
|
|
<li>any <code>locals</code> (if specified)</li>
|
|
<li>the resolved return values of all injectables</li>
|
|
<li>any values inherited from a <code>parent</code> call to <code>$resolve</code> (if specified)</li>
|
|
</ul>
|
|
<p>The promise will resolve after the <code>parent</code> promise (if any) and all promises returned by injectables
|
|
have been resolved. If any invocable (or <code>$injector.invoke</code>) throws an exception, or if a promise
|
|
returned by an invocable is rejected, the <code>$resolve</code> promise is immediately rejected with the same error.
|
|
A rejection of a <code>parent</code> promise (if specified) will likewise be propagated immediately. Once the
|
|
<code>$resolve</code> promise has been rejected, no further invocables will be called.</p>
|
|
<p>Cyclic dependencies between invocables are not permitted and will caues <code>$resolve</code> to throw an
|
|
error. As a special case, an injectable can depend on a parameter with the same name as the injectable,
|
|
which will be fulfilled from the <code>parent</code> injectable of the same name. This allows inherited values
|
|
to be decorated. Note that in this case any other injectable in the same <code>$resolve</code> with the same
|
|
dependency would see the decorated value, not the inherited value.</p>
|
|
<p>Note that missing dependencies -- unlike cyclic dependencies -- will cause an (asynchronous) rejection
|
|
of the <code>$resolve</code> promise rather than a (synchronous) exception.</p>
|
|
<p>Invocables are invoked eagerly as soon as all dependencies are available. This is true even for
|
|
dependencies inherited from a <code>parent</code> call to <code>$resolve</code>.</p>
|
|
<p>As a special case, an invocable can be a string, in which case it is taken to be a service name
|
|
to be passed to <code>$injector.get()</code>. This is supported primarily for backwards-compatibility with the
|
|
<code>resolve</code> property of <code>$routeProvider</code> routes.</p>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h5>Parameters:</h5>
|
|
|
|
|
|
<table class="params">
|
|
<thead>
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
|
|
<th>Type</th>
|
|
|
|
|
|
<th>Argument</th>
|
|
|
|
|
|
|
|
|
|
<th class="last">Description</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
|
|
<tr>
|
|
|
|
<td class="name"><code>invocables</code></td>
|
|
|
|
|
|
<td class="type">
|
|
|
|
|
|
<span class="param-type">Object.<string, (function()|string)></span>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td class="attributes">
|
|
|
|
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
<td class="description last"><p>functions to invoke or <code>$injector</code> services to fetch.</p></td>
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td class="name"><code>locals</code></td>
|
|
|
|
|
|
<td class="type">
|
|
|
|
|
|
<span class="param-type">Object.<string, *></span>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td class="attributes">
|
|
|
|
<optional><br>
|
|
|
|
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
<td class="description last"><p>values to make available to the injectables</p></td>
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td class="name"><code>parent</code></td>
|
|
|
|
|
|
<td class="type">
|
|
|
|
|
|
<span class="param-type">Promise.<Object></span>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td class="attributes">
|
|
|
|
<optional><br>
|
|
|
|
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
<td class="description last"><p>a promise returned by another call to <code>$resolve</code>.</p></td>
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td class="name"><code>self</code></td>
|
|
|
|
|
|
<td class="type">
|
|
|
|
|
|
<span class="param-type">Object</span>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td class="attributes">
|
|
|
|
<optional><br>
|
|
|
|
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
<td class="description last"><p>the <code>this</code> for the invoked methods</p></td>
|
|
</tr>
|
|
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
|
|
|
|
<dl class="details">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<dt class="tag-source">Source:</dt>
|
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
<a href="resolve.js.html">resolve.js</a>, <a href="resolve.js.html#line209">line 209</a>
|
|
</li></ul></dd>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h5>Returns:</h5>
|
|
|
|
|
|
<div class="param-desc">
|
|
<p>Promise for an object that contains the resolved return value
|
|
of all invocables, as well as any inherited and local values.</p>
|
|
</div>
|
|
|
|
|
|
|
|
<dl>
|
|
<dt>
|
|
Type
|
|
</dt>
|
|
<dd>
|
|
|
|
<span class="param-type">Promise.<Object></span>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<h4 class="name" id="study"><span class="type-signature"></span>study<span class="signature">(invocables)</span><span class="type-signature"> → {function}</span></h4>
|
|
|
|
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
<div class="description">
|
|
<p>Studies a set of invocables that are likely to be used multiple times.
|
|
$resolve.study(invocables)(locals, parent, self)
|
|
is equivalent to
|
|
$resolve.resolve(invocables, locals, parent, self)
|
|
but the former is more efficient (in fact <code>resolve</code> just calls <code>study</code> internally).
|
|
See module:$resolve/resolve for details.</p>
|
|
</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>invocables</code></td>
|
|
|
|
|
|
<td class="type">
|
|
|
|
|
|
<span class="param-type">Object</span>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
<td class="description last"></td>
|
|
</tr>
|
|
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
|
|
|
|
<dl class="details">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<dt class="tag-source">Source:</dt>
|
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
<a href="resolve.js.html">resolve.js</a>, <a href="resolve.js.html#line29">line 29</a>
|
|
</li></ul></dd>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h5>Returns:</h5>
|
|
|
|
|
|
|
|
|
|
<dl>
|
|
<dt>
|
|
Type
|
|
</dt>
|
|
<dd>
|
|
|
|
<span class="param-type">function</span>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
</article>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<nav>
|
|
<h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="$resolve.html">$resolve</a></li></ul><h3>Classes</h3><ul><li><a href="$templateFactory.html">$templateFactory</a></li><li><a href="$urlMatcherFactory.html">$urlMatcherFactory</a></li><li><a href="UrlMatcher.html">UrlMatcher</a></li></ul><h3>Global</h3><ul><li><a href="global.html#ancestors">ancestors</a></li><li><a href="global.html#arraySearch">arraySearch</a></li><li><a href="global.html#equalForKeys">equalForKeys</a></li><li><a href="global.html#filterByKeys">filterByKeys</a></li><li><a href="global.html#inheritParams">inheritParams</a></li><li><a href="global.html#keys">keys</a></li><li><a href="global.html#normalize">normalize</a></li></ul>
|
|
</nav>
|
|
|
|
<br clear="both">
|
|
|
|
<footer>
|
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Dec 09 2013 13:59:32 GMT-0500 (EST)
|
|
</footer>
|
|
|
|
<script> prettyPrint(); </script>
|
|
<script src="scripts/linenumber.js"> </script>
|
|
</body>
|
|
</html> |