5 <title>JSDoc: Class: LuCI</title>
7 <script src="scripts/prettify/prettify.js"> </script>
8 <script src="scripts/prettify/lang-css.js"> </script>
10 <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
12 <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13 <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
20 <h1 class="page-title">Class: LuCI</h1>
31 <h2><span class="attribs"><span class="type-signature"></span></span>LuCI<span class="signature">(env)</span><span class="type-signature"></span></h2>
33 <div class="class-description"><p>This is the LuCI base class. It is automatically instantiated and
34 accessible using the global <code>L</code> variable.</p></div>
40 <div class="container-overview">
49 <h4 class="name" id="LuCI"><span class="type-signature"></span>new LuCI<span class="signature">(env)</span><span class="type-signature"></span></h4>
67 <table class="params">
80 <th class="last">Description</th>
89 <td class="name"><code>env</code></td>
95 <span class="param-type">Object</span>
105 <td class="description last"><p>The environment settings to use for the LuCI runtime.</p></td>
144 <dt class="tag-source">Source:</dt>
145 <dd class="tag-source"><ul class="dummy"><li>
146 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1">line 1</a>
184 <h3 class="subsection-title">Classes</h3>
187 <dt><a href="LuCI.Class.html">Class</a></dt>
190 <dt><a href="LuCI.dom.html">dom</a></dt>
193 <dt><a href="LuCI.fs.html">fs</a></dt>
196 <dt><a href="LuCI.Headers.html">Headers</a></dt>
199 <dt><a href="LuCI.Network.html">Network</a></dt>
202 <dt><a href="LuCI.Poll.html">Poll</a></dt>
205 <dt><a href="LuCI.Request.html">Request</a></dt>
208 <dt><a href="LuCI.Response.html">Response</a></dt>
211 <dt><a href="LuCI.rpc.html">rpc</a></dt>
214 <dt><a href="LuCI.uci.html">uci</a></dt>
217 <dt><a href="LuCI.view.html">view</a></dt>
220 <dt><a href="LuCI.XHR.html">XHR</a></dt>
232 <h3 class="subsection-title">Members</h3>
236 <h4 class="name" id="env"><span class="type-signature"></span>env<span class="type-signature"></span></h4>
241 <div class="description">
242 <p>The <code>env</code> object holds environment settings used by LuCI, such
243 as request timeouts, base URLs etc.</p>
279 <dt class="tag-source">Source:</dt>
280 <dd class="tag-source"><ul class="dummy"><li>
281 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1657">line 1657</a>
301 <h3 class="subsection-title">Methods</h3>
309 <h4 class="name" id="bind"><span class="type-signature"></span>bind<span class="signature">(fn, self, …args<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {function}</span></h4>
316 <div class="description">
317 <p>Return a bound function using the given <code>self</code> as <code>this</code> context
318 and any further arguments as parameters to the bound function.</p>
332 <table class="params">
347 <th class="last">Description</th>
356 <td class="name"><code>fn</code></td>
362 <span class="param-type">function</span>
369 <td class="attributes">
380 <td class="description last"><p>The function to bind.</p></td>
387 <td class="name"><code>self</code></td>
393 <span class="param-type">*</span>
400 <td class="attributes">
411 <td class="description last"><p>The value to bind as <code>this</code> context to the specified function.</p></td>
418 <td class="name"><code>args</code></td>
424 <span class="param-type">*</span>
431 <td class="attributes">
446 <td class="description last"><p>Zero or more variable arguments which are bound to the function
447 as parameters.</p></td>
486 <dt class="tag-source">Source:</dt>
487 <dd class="tag-source"><ul class="dummy"><li>
488 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1340">line 1340</a>
516 <div class="param-desc">
517 <p>Returns the bound function.</p>
528 <span class="param-type">function</span>
546 <h4 class="name" id="error"><span class="type-signature"></span>error<span class="signature">(type<span class="signature-attributes">opt</span>, fmt<span class="signature-attributes">opt</span>, …args<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
553 <div class="description">
554 <p>A wrapper around <a href="LuCI.html#raise"><code>raise()</code></a> which also renders
555 the error either as modal overlay when <code>ui.js</code> is already loaed
556 or directly into the view body.</p>
570 <table class="params">
587 <th class="last">Description</th>
596 <td class="name"><code>type</code></td>
602 <span class="param-type">Error</span>
605 <span class="param-type">string</span>
612 <td class="attributes">
631 <td class="description last"><p>Either a string specifying the type of the error to throw or an
632 existing <code>Error</code> instance to copy.</p></td>
639 <td class="name"><code>fmt</code></td>
645 <span class="param-type">string</span>
652 <td class="attributes">
671 <td class="description last"><p>A format string which is used to form the error message, together
672 with all subsequent optional arguments.</p></td>
679 <td class="name"><code>args</code></td>
685 <span class="param-type">*</span>
692 <td class="attributes">
711 <td class="description last"><p>Zero or more variable arguments to the supplied format string.</p></td>
750 <dt class="tag-source">Source:</dt>
751 <dd class="tag-source"><ul class="dummy"><li>
752 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1300">line 1300</a>
781 <div class="param-desc">
782 <p>Throws the created error object with the captured stack trace
783 appended to the message and the type set to the given type
784 argument or copied from the given error instance.</p>
795 <span class="param-type">Error</span>
819 <h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(url, args<span class="signature-attributes">opt</span>, cb)</span><span class="type-signature"> → {Promise.<null>}</span></h4>
826 <div class="description">
827 <p>Issues a GET request to the given url and invokes the specified
828 callback function. The function is a wrapper around
829 <a href="LuCI.Request.html#request"><code>Request.request()</code></a>.</p>
843 <table class="params">
858 <th class="last">Description</th>
867 <td class="name"><code>url</code></td>
873 <span class="param-type">string</span>
880 <td class="attributes">
891 <td class="description last"><p>The URL to request.</p></td>
898 <td class="name"><code>args</code></td>
904 <span class="param-type">Object.<string, string></span>
911 <td class="attributes">
924 <td class="description last"><p>Additional query string arguments to append to the URL.</p></td>
931 <td class="name"><code>cb</code></td>
937 <span class="param-type"><a href="LuCI.html#.requestCallbackFn">LuCI.requestCallbackFn</a></span>
944 <td class="attributes">
955 <td class="description last"><p>The callback function to invoke when the request finishes.</p></td>
984 <dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
996 <dt class="tag-source">Source:</dt>
997 <dd class="tag-source"><ul class="dummy"><li>
998 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1918">line 1918</a>
1026 <div class="param-desc">
1027 <p>Returns a promise resolving to <code>null</code> when concluded.</p>
1038 <span class="param-type">Promise.<null></span>
1056 <h4 class="name" id="halt"><span class="type-signature"></span>halt<span class="signature">()</span><span class="type-signature"> → {boolean}</span></h4>
1063 <div class="description">
1064 <p>Deprecated wrapper around <code>Poll.stop()</code>.</p>
1079 <dl class="details">
1096 <dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
1108 <dt class="tag-source">Source:</dt>
1109 <dd class="tag-source"><ul class="dummy"><li>
1110 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line2040">line 2040</a>
1138 <div class="param-desc">
1139 <p>Returns <code>true</code> when the polling loop has been stopped or <code>false</code>
1140 when it didn't run to begin with.</p>
1151 <span class="param-type">boolean</span>
1169 <h4 class="name" id="hasSystemFeature"><span class="type-signature"></span>hasSystemFeature<span class="signature">(feature, subfeature<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {boolean|null}</span></h4>
1176 <div class="description">
1177 <p>Test whether a particular system feature is available, such as
1178 hostapd SAE support or an installed firewall. The features are
1179 queried once at the beginning of the LuCI session and cached in
1180 <code>SessionStorage</code> throughout the lifetime of the associated tab or
1192 <h5>Parameters:</h5>
1195 <table class="params">
1210 <th class="last">Description</th>
1219 <td class="name"><code>feature</code></td>
1225 <span class="param-type">string</span>
1232 <td class="attributes">
1243 <td class="description last"><p>The feature to test. For detailed list of known feature flags,
1244 see <code>/modules/luci-base/root/usr/libexec/rpcd/luci</code>.</p></td>
1251 <td class="name"><code>subfeature</code></td>
1257 <span class="param-type">string</span>
1264 <td class="attributes">
1277 <td class="description last"><p>Some feature classes like <code>hostapd</code> provide sub-feature flags,
1278 such as <code>sae</code> or <code>11w</code> support. The <code>subfeature</code> argument can
1279 be used to query these.</p></td>
1291 <dl class="details">
1318 <dt class="tag-source">Source:</dt>
1319 <dd class="tag-source"><ul class="dummy"><li>
1320 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1574">line 1574</a>
1348 <div class="param-desc">
1349 <p>Return <code>true</code> if the queried feature (and sub-feature) is available
1350 or <code>false</code> if the requested feature isn't present or known.
1351 Return <code>null</code> when a sub-feature was queried for a feature which
1352 has no sub-features.</p>
1363 <span class="param-type">boolean</span>
1366 <span class="param-type">null</span>
1384 <h4 class="name" id="isObject"><span class="type-signature"></span>isObject<span class="signature">(val<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {boolean}</span></h4>
1391 <div class="description">
1392 <p>Tests whether the passed argument is a JavaScript object.
1393 This function is meant to be an object counterpart to the
1394 standard <code>Array.isArray()</code> function.</p>
1405 <h5>Parameters:</h5>
1408 <table class="params">
1423 <th class="last">Description</th>
1432 <td class="name"><code>val</code></td>
1438 <span class="param-type">*</span>
1445 <td class="attributes">
1458 <td class="description last"><p>The value to test</p></td>
1470 <dl class="details">
1497 <dt class="tag-source">Source:</dt>
1498 <dd class="tag-source"><ul class="dummy"><li>
1499 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1765">line 1765</a>
1527 <div class="param-desc">
1528 <p>Returns <code>true</code> if the given value is of type object and
1529 not <code>null</code>, else returns <code>false</code>.</p>
1540 <span class="param-type">boolean</span>
1558 <h4 class="name" id="location"><span class="type-signature"></span>location<span class="signature">()</span><span class="type-signature"> → {string}</span></h4>
1565 <div class="description">
1566 <p>Return the complete URL path to the current view.</p>
1581 <dl class="details">
1608 <dt class="tag-source">Source:</dt>
1609 <dd class="tag-source"><ul class="dummy"><li>
1610 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1745">line 1745</a>
1638 <div class="param-desc">
1639 <p>Returns the URL path to the current view.</p>
1650 <span class="param-type">string</span>
1668 <h4 class="name" id="path"><span class="type-signature"></span>path<span class="signature">(prefix<span class="signature-attributes">opt</span>, parts<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {string}</span></h4>
1675 <div class="description">
1676 <p>Construct a relative URL path from the given prefix and parts.
1677 The resulting URL is guaranteed to only contain the characters
1678 <code>a-z</code>, <code>A-Z</code>, <code>0-9</code>, <code>_</code>, <code>.</code>, <code>%</code>, <code>,</code>, <code>;</code>, and <code>-</code> as well
1679 as <code>/</code> for the path separator.</p>
1690 <h5>Parameters:</h5>
1693 <table class="params">
1708 <th class="last">Description</th>
1717 <td class="name"><code>prefix</code></td>
1723 <span class="param-type">string</span>
1730 <td class="attributes">
1743 <td class="description last"><p>The prefix to join the given parts with. If the <code>prefix</code> is
1744 omitted, it defaults to an empty string.</p></td>
1751 <td class="name"><code>parts</code></td>
1757 <span class="param-type">Array.<string></span>
1764 <td class="attributes">
1777 <td class="description last"><p>An array of parts to join into an URL path. Parts may contain
1778 slashes and any of the other characters mentioned above.</p></td>
1790 <dl class="details">
1817 <dt class="tag-source">Source:</dt>
1818 <dd class="tag-source"><ul class="dummy"><li>
1819 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1679">line 1679</a>
1847 <div class="param-desc">
1848 <p>Return the joined URL path.</p>
1859 <span class="param-type">string</span>
1877 <h4 class="name" id="poll"><span class="type-signature"></span>poll<span class="signature">(interval, url, args<span class="signature-attributes">opt</span>, cb, post<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {function}</span></h4>
1884 <div class="description">
1885 <p>Register a polling HTTP request that invokes the specified
1886 callback function. The function is a wrapper around
1887 <a href="LuCI.Request.poll.html#add"><code>Request.poll.add()</code></a>.</p>
1898 <h5>Parameters:</h5>
1901 <table class="params">
1918 <th class="last">Description</th>
1927 <td class="name"><code>interval</code></td>
1933 <span class="param-type">number</span>
1940 <td class="attributes">
1950 <td class="default">
1955 <td class="description last"><p>The poll interval to use. If set to a value less than or equal
1956 to <code>0</code>, it will default to the global poll interval configured
1957 in <code>LuCI.env.pollinterval</code>.</p></td>
1964 <td class="name"><code>url</code></td>
1970 <span class="param-type">string</span>
1977 <td class="attributes">
1987 <td class="default">
1992 <td class="description last"><p>The URL to request.</p></td>
1999 <td class="name"><code>args</code></td>
2005 <span class="param-type">Object.<string, string></span>
2012 <td class="attributes">
2024 <td class="default">
2029 <td class="description last"><p>Specifies additional arguments for the request. For GET requests,
2030 the arguments are appended to the URL as query string, for POST
2031 requests, they'll be added to the request body.</p></td>
2038 <td class="name"><code>cb</code></td>
2044 <span class="param-type"><a href="LuCI.html#.requestCallbackFn">LuCI.requestCallbackFn</a></span>
2051 <td class="attributes">
2061 <td class="default">
2066 <td class="description last"><p>The callback function to invoke whenever a request finishes.</p></td>
2073 <td class="name"><code>post</code></td>
2079 <span class="param-type">boolean</span>
2086 <td class="attributes">
2098 <td class="default">
2105 <td class="description last"><p>When set to <code>false</code> or not specified, poll requests will be made
2106 using the GET method. When set to <code>true</code>, POST requests will be
2107 issued. In case of POST requests, the request body will contain
2108 an argument <code>token</code> with the current value of <code>LuCI.env.token</code> by
2109 default, regardless of the parameters specified with <code>args</code>.</p></td>
2121 <dl class="details">
2138 <dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
2150 <dt class="tag-source">Source:</dt>
2151 <dd class="tag-source"><ul class="dummy"><li>
2152 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1988">line 1988</a>
2180 <div class="param-desc">
2181 <p>Returns the internally created function that has been passed to
2182 <a href="LuCI.Request.poll.html#add"><code>Request.poll.add()</code></a>. This value can
2183 be passed to <code>Poll.remove()</code> to remove the
2184 polling request.</p>
2195 <span class="param-type">function</span>
2213 <h4 class="name" id="post"><span class="type-signature"></span>post<span class="signature">(url, args<span class="signature-attributes">opt</span>, cb)</span><span class="type-signature"> → {Promise.<null>}</span></h4>
2220 <div class="description">
2221 <p>Issues a POST request to the given url and invokes the specified
2222 callback function. The function is a wrapper around
2223 <a href="LuCI.Request.html#request"><code>Request.request()</code></a>. The request is
2224 sent using <code>application/x-www-form-urlencoded</code> encoding and will
2225 contain a field <code>token</code> with the current value of <code>LuCI.env.token</code>
2237 <h5>Parameters:</h5>
2240 <table class="params">
2255 <th class="last">Description</th>
2264 <td class="name"><code>url</code></td>
2270 <span class="param-type">string</span>
2277 <td class="attributes">
2288 <td class="description last"><p>The URL to request.</p></td>
2295 <td class="name"><code>args</code></td>
2301 <span class="param-type">Object.<string, string></span>
2308 <td class="attributes">
2321 <td class="description last"><p>Additional post arguments to append to the request body.</p></td>
2328 <td class="name"><code>cb</code></td>
2334 <span class="param-type"><a href="LuCI.html#.requestCallbackFn">LuCI.requestCallbackFn</a></span>
2341 <td class="attributes">
2352 <td class="description last"><p>The callback function to invoke when the request finishes.</p></td>
2364 <dl class="details">
2381 <dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
2393 <dt class="tag-source">Source:</dt>
2394 <dd class="tag-source"><ul class="dummy"><li>
2395 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1946">line 1946</a>
2423 <div class="param-desc">
2424 <p>Returns a promise resolving to <code>null</code> when concluded.</p>
2435 <span class="param-type">Promise.<null></span>
2453 <h4 class="name" id="raise"><span class="type-signature"></span>raise<span class="signature">(type<span class="signature-attributes">opt</span>, fmt<span class="signature-attributes">opt</span>, …args<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
2460 <div class="description">
2461 <p>Captures the current stack trace and throws an error of the
2462 specified type as a new exception. Also logs the exception as
2463 error to the debug console if it is available.</p>
2474 <h5>Parameters:</h5>
2477 <table class="params">
2494 <th class="last">Description</th>
2503 <td class="name"><code>type</code></td>
2509 <span class="param-type">Error</span>
2512 <span class="param-type">string</span>
2519 <td class="attributes">
2531 <td class="default">
2538 <td class="description last"><p>Either a string specifying the type of the error to throw or an
2539 existing <code>Error</code> instance to copy.</p></td>
2546 <td class="name"><code>fmt</code></td>
2552 <span class="param-type">string</span>
2559 <td class="attributes">
2571 <td class="default">
2578 <td class="description last"><p>A format string which is used to form the error message, together
2579 with all subsequent optional arguments.</p></td>
2586 <td class="name"><code>args</code></td>
2592 <span class="param-type">*</span>
2599 <td class="attributes">
2613 <td class="default">
2618 <td class="description last"><p>Zero or more variable arguments to the supplied format string.</p></td>
2630 <dl class="details">
2657 <dt class="tag-source">Source:</dt>
2658 <dd class="tag-source"><ul class="dummy"><li>
2659 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1234">line 1234</a>
2688 <div class="param-desc">
2689 <p>Throws the created error object with the captured stack trace
2690 appended to the message and the type set to the given type
2691 argument or copied from the given error instance.</p>
2702 <span class="param-type">Error</span>
2726 <h4 class="name" id="require"><span class="type-signature"></span>require<span class="signature">(name)</span><span class="type-signature"> → {Promise.<LuCI#Class>}</span></h4>
2733 <div class="description">
2734 <p>Load an additional LuCI JavaScript class and its dependencies,
2735 instantiate it and return the resulting class instance. Each
2736 class is only loaded once. Subsequent attempts to load the same
2737 class will return the already instantiated class.</p>
2748 <h5>Parameters:</h5>
2751 <table class="params">
2764 <th class="last">Description</th>
2773 <td class="name"><code>name</code></td>
2779 <span class="param-type">string</span>
2789 <td class="description last"><p>The name of the class to load in dotted notation. Dots will
2790 be replaced by spaces and joined with the runtime-determined
2791 base URL of LuCI.js to form an absolute URL to load the class
2804 <dl class="details">
2831 <dt class="tag-source">Source:</dt>
2832 <dd class="tag-source"><ul class="dummy"><li>
2833 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1379">line 1379</a>
2862 <div class="param-desc">
2863 <p>Throws a <code>DependencyError</code> when the class to load includes
2864 circular dependencies.</p>
2875 <span class="param-type">DependencyError</span>
2890 <div class="param-desc">
2891 <p>Throws <code>NetworkError</code> when the underlying <a href="LuCI.Request.html"><code>LuCI.Request</code></a>
2903 <span class="param-type">NetworkError</span>
2918 <div class="param-desc">
2919 <p>Throws <code>SyntaxError</code> when the loaded class file code cannot
2920 be interpreted by <code>eval</code>.</p>
2931 <span class="param-type">SyntaxError</span>
2946 <div class="param-desc">
2947 <p>Throws <code>TypeError</code> when the class file could be loaded and
2948 interpreted, but when invoking its code did not yield a valid
2960 <span class="param-type">TypeError</span>
2976 <div class="param-desc">
2977 <p>Returns the instantiated class.</p>
2988 <span class="param-type">Promise.<LuCI#Class></span>
3006 <h4 class="name" id="resolveDefault"><span class="type-signature"></span>resolveDefault<span class="signature">(value, defvalue)</span><span class="type-signature"> → {Promise.<*>}</span></h4>
3013 <div class="description">
3014 <p>Returns a promise resolving with either the given value or or with
3015 the given default in case the input value is a rejecting promise.</p>
3026 <h5>Parameters:</h5>
3029 <table class="params">
3042 <th class="last">Description</th>
3051 <td class="name"><code>value</code></td>
3057 <span class="param-type">*</span>
3067 <td class="description last"><p>The value to resolve the promise with.</p></td>
3074 <td class="name"><code>defvalue</code></td>
3080 <span class="param-type">*</span>
3090 <td class="description last"><p>The default value to resolve the promise with in case the given
3091 input value is a rejecting promise.</p></td>
3103 <dl class="details">
3130 <dt class="tag-source">Source:</dt>
3131 <dd class="tag-source"><ul class="dummy"><li>
3132 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1873">line 1873</a>
3160 <div class="param-desc">
3161 <p>Returns a new promise resolving either to the given input value or
3162 to the given default value on error.</p>
3173 <span class="param-type">Promise.<*></span>
3191 <h4 class="name" id="resource"><span class="type-signature"></span>resource<span class="signature">(parts<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {string}</span></h4>
3198 <div class="description">
3199 <p>Construct an URL path relative to the global static resource path
3200 of the LuCI ui (usually <code>/luci-static/resources</code>).</p>
3201 <p>The resulting URL is guaranteed to only contain the characters
3202 <code>a-z</code>, <code>A-Z</code>, <code>0-9</code>, <code>_</code>, <code>.</code>, <code>%</code>, <code>,</code>, <code>;</code>, and <code>-</code> as well
3203 as <code>/</code> for the path separator.</p>
3214 <h5>Parameters:</h5>
3217 <table class="params">
3232 <th class="last">Description</th>
3241 <td class="name"><code>parts</code></td>
3247 <span class="param-type">Array.<string></span>
3254 <td class="attributes">
3267 <td class="description last"><p>An array of parts to join into an URL path. Parts may contain
3268 slashes and any of the other characters mentioned above.</p></td>
3280 <dl class="details">
3307 <dt class="tag-source">Source:</dt>
3308 <dd class="tag-source"><ul class="dummy"><li>
3309 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1732">line 1732</a>
3337 <div class="param-desc">
3338 <p>Returns the resulting URL path.</p>
3349 <span class="param-type">string</span>
3367 <h4 class="name" id="run"><span class="type-signature"></span>run<span class="signature">()</span><span class="type-signature"> → {boolean}</span></h4>
3374 <div class="description">
3375 <p>Deprecated wrapper around <code>Poll.start()</code>.</p>
3390 <dl class="details">
3407 <dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
3419 <dt class="tag-source">Source:</dt>
3420 <dd class="tag-source"><ul class="dummy"><li>
3421 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line2053">line 2053</a>
3449 <div class="param-desc">
3450 <p>Returns <code>true</code> when the polling loop has been started or <code>false</code>
3451 when it was already running.</p>
3462 <span class="param-type">boolean</span>
3480 <h4 class="name" id="sortedKeys"><span class="type-signature"></span>sortedKeys<span class="signature">(obj, key<span class="signature-attributes">opt</span>, sortmode<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Array.<string>}</span></h4>
3487 <div class="description">
3488 <p>Return an array of sorted object keys, optionally sorted by
3489 a different key or a different sorting mode.</p>
3500 <h5>Parameters:</h5>
3503 <table class="params">
3518 <th class="last">Description</th>
3527 <td class="name"><code>obj</code></td>
3533 <span class="param-type">object</span>
3540 <td class="attributes">
3551 <td class="description last"><p>The object to extract the keys from. If the given value is
3552 not an object, the function will return an empty array.</p></td>
3559 <td class="name"><code>key</code></td>
3565 <span class="param-type">string</span>
3572 <td class="attributes">
3585 <td class="description last"><p>Specifies the key to order by. This is mainly useful for
3586 nested objects of objects or objects of arrays when sorting
3587 shall not be performed by the primary object keys but by
3588 some other key pointing to a value within the nested values.</p></td>
3595 <td class="name"><code>sortmode</code></td>
3601 <span class="param-type">string</span>
3608 <td class="attributes">
3621 <td class="description last"><p>May be either <code>addr</code> or <code>num</code> to override the natural
3622 lexicographic sorting with a sorting suitable for IP/MAC style
3623 addresses or numeric values respectively.</p></td>
3635 <dl class="details">
3662 <dt class="tag-source">Source:</dt>
3663 <dd class="tag-source"><ul class="dummy"><li>
3664 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1794">line 1794</a>
3692 <div class="param-desc">
3693 <p>Returns an array containing the sorted keys of the given object.</p>
3704 <span class="param-type">Array.<string></span>
3722 <h4 class="name" id="stop"><span class="type-signature"></span>stop<span class="signature">(entry)</span><span class="type-signature"> → {boolean}</span></h4>
3729 <div class="description">
3730 <p>Deprecated wrapper around <code>Poll.remove()</code>.</p>
3741 <h5>Parameters:</h5>
3744 <table class="params">
3757 <th class="last">Description</th>
3766 <td class="name"><code>entry</code></td>
3772 <span class="param-type">function</span>
3782 <td class="description last"><p>The polling function to remove.</p></td>
3794 <dl class="details">
3811 <dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
3823 <dt class="tag-source">Source:</dt>
3824 <dd class="tag-source"><ul class="dummy"><li>
3825 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line2027">line 2027</a>
3853 <div class="param-desc">
3854 <p>Returns <code>true</code> when the function has been removed or <code>false</code> if
3855 it could not be found.</p>
3866 <span class="param-type">boolean</span>
3884 <h4 class="name" id="toArray"><span class="type-signature"></span>toArray<span class="signature">(val)</span><span class="type-signature"> → {Array.<*>}</span></h4>
3891 <div class="description">
3892 <p>Converts the given value to an array. If the given value is of
3893 type array, it is returned as-is, values of type object are
3894 returned as one-element array containing the object, empty
3895 strings and <code>null</code> values are returned as empty array, all other
3896 values are converted using <code>String()</code>, trimmed, split on white
3897 space and returned as array.</p>
3908 <h5>Parameters:</h5>
3911 <table class="params">
3924 <th class="last">Description</th>
3933 <td class="name"><code>val</code></td>
3939 <span class="param-type">*</span>
3949 <td class="description last"><p>The value to convert into an array.</p></td>
3961 <dl class="details">
3988 <dt class="tag-source">Source:</dt>
3989 <dd class="tag-source"><ul class="dummy"><li>
3990 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1839">line 1839</a>
4018 <div class="param-desc">
4019 <p>Returns the resulting array.</p>
4030 <span class="param-type">Array.<*></span>
4048 <h4 class="name" id="url"><span class="type-signature"></span>url<span class="signature">(parts<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {string}</span></h4>
4055 <div class="description">
4056 <p>Construct an URL pathrelative to the script path of the server
4057 side LuCI application (usually <code>/cgi-bin/luci</code>).</p>
4058 <p>The resulting URL is guaranteed to only contain the characters
4059 <code>a-z</code>, <code>A-Z</code>, <code>0-9</code>, <code>_</code>, <code>.</code>, <code>%</code>, <code>,</code>, <code>;</code>, and <code>-</code> as well
4060 as <code>/</code> for the path separator.</p>
4071 <h5>Parameters:</h5>
4074 <table class="params">
4089 <th class="last">Description</th>
4098 <td class="name"><code>parts</code></td>
4104 <span class="param-type">Array.<string></span>
4111 <td class="attributes">
4124 <td class="description last"><p>An array of parts to join into an URL path. Parts may contain
4125 slashes and any of the other characters mentioned above.</p></td>
4137 <dl class="details">
4164 <dt class="tag-source">Source:</dt>
4165 <dd class="tag-source"><ul class="dummy"><li>
4166 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1710">line 1710</a>
4194 <div class="param-desc">
4195 <p>Returns the resulting URL path.</p>
4206 <span class="param-type">string</span>
4222 <h3 class="subsection-title">Type Definitions</h3>
4230 <h4 class="name" id=".requestCallbackFn"><span class="type-signature"></span>requestCallbackFn<span class="signature">(xhr, data, duration)</span><span class="type-signature"></span></h4>
4237 <div class="description">
4238 <p>The request callback function is invoked whenever an HTTP
4239 reply to a request made using the <code>L.get()</code>, <code>L.post()</code> or
4240 <code>L.poll()</code> function is timed out or received successfully.</p>
4251 <h5>Parameters:</h5>
4254 <table class="params">
4267 <th class="last">Description</th>
4276 <td class="name"><code>xhr</code></td>
4282 <span class="param-type">XMLHTTPRequest</span>
4292 <td class="description last"><p>The XMLHTTPRequest instance used to make the request.</p></td>
4299 <td class="name"><code>data</code></td>
4305 <span class="param-type">*</span>
4315 <td class="description last"><p>The response JSON if the response could be parsed as such,
4316 else <code>null</code>.</p></td>
4323 <td class="name"><code>duration</code></td>
4329 <span class="param-type">number</span>
4339 <td class="description last"><p>The total duration of the request in milliseconds.</p></td>
4351 <dl class="details">
4378 <dt class="tag-source">Source:</dt>
4379 <dd class="tag-source"><ul class="dummy"><li>
4380 <a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line1877">line 1877</a>
4424 <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="LuCI.html">LuCI</a></li><li><a href="LuCI.Class.html">Class</a></li><li><a href="LuCI.dom.html">dom</a></li><li><a href="LuCI.fs.html">fs</a></li><li><a href="LuCI.Headers.html">Headers</a></li><li><a href="LuCI.Network.html">Network</a></li><li><a href="LuCI.Network.Device.html">Device</a></li><li><a href="LuCI.Network.Hosts.html">Hosts</a></li><li><a href="LuCI.Network.Protocol.html">Protocol</a></li><li><a href="LuCI.Network.WifiDevice.html">WifiDevice</a></li><li><a href="LuCI.Network.WifiNetwork.html">WifiNetwork</a></li><li><a href="LuCI.Poll.html">Poll</a></li><li><a href="LuCI.Request.html">Request</a></li><li><a href="LuCI.Request.poll.html">poll</a></li><li><a href="LuCI.Response.html">Response</a></li><li><a href="LuCI.rpc.html">rpc</a></li><li><a href="LuCI.uci.html">uci</a></li><li><a href="LuCI.view.html">view</a></li><li><a href="LuCI.XHR.html">XHR</a></li></ul>
4430 Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Tue Nov 05 2019 09:33:05 GMT+0100 (Central European Standard Time)
4433 <script> prettyPrint(); </script>
4434 <script src="scripts/linenumber.js"> </script>