luci/documentation/jsapi/LuCI.XHR.html

1134 lines
15 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: XHR</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: XHR</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>
<span class="ancestors"><a href="LuCI.html">LuCI</a>.</span>XHR<span class="signature">()</span><span class="type-signature"></span></h2>
<div class="class-description"><p>The <code>LuCI.XHR</code> class is a legacy compatibility shim for the
functionality formerly provided by <code>xhr.js</code>. It is registered as global
<code>window.XHR</code> symbol for compatibility with legacy code.</p>
<p>New code should use <a href="LuCI.Request.html"><code>LuCI.Request</code></a> instead to implement HTTP
request handling.</p></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="XHR"><span class="type-signature"></span>new XHR<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line2943">line 2943</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="abort"><span class="type-signature"></span>abort<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Ignored for backwards compatibility.</p>
<p>This function does nothing.</p>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line3046">line 3046</a>
</li></ul></dd>
</dl>
<h4 class="name" id="busy"><span class="type-signature"></span>busy<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
<p>Checks the running state of the request.</p>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line3035">line 3035</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns <code>true</code> if the request is still running or <code>false</code> if it
already completed.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="cancel"><span class="type-signature"></span>cancel<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Cancels a running request.</p>
<p>This function does not actually cancel the underlying
<code>XMLHTTPRequest</code> request but it sets a flag which prevents the
invocation of the callback function when the request eventually
finishes or timed out.</p>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line3022">line 3022</a>
</li></ul></dd>
</dl>
<h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(url, data<span class="signature-attributes">opt</span>, callback<span class="signature-attributes">opt</span>, timeout<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;null>}</span></h4>
<div class="description">
<p>This function is a legacy wrapper around
<a href="LuCI.html#get"><code>LuCI.get()</code></a>.</p>
</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>url</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>The URL to request</p></td>
</tr>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Additional query string data</p></td>
</tr>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type"><a href="LuCI.html#.requestCallbackFn">LuCI.requestCallbackFn</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Callback function to invoke on completion</p></td>
</tr>
<tr>
<td class="name"><code>timeout</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Request timeout to use</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line2978">line 2978</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;null></span>
</dd>
</dl>
<h4 class="name" id="post"><span class="type-signature"></span>post<span class="signature">(url, data<span class="signature-attributes">opt</span>, callback<span class="signature-attributes">opt</span>, timeout<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;null>}</span></h4>
<div class="description">
<p>This function is a legacy wrapper around
<a href="LuCI.html#post"><code>LuCI.post()</code></a>.</p>
</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>url</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>The URL to request</p></td>
</tr>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Additional data to append to the request body.</p></td>
</tr>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type"><a href="LuCI.html#.requestCallbackFn">LuCI.requestCallbackFn</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Callback function to invoke on completion</p></td>
</tr>
<tr>
<td class="name"><code>timeout</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Request timeout to use</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line3005">line 3005</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;null></span>
</dd>
</dl>
<h4 class="name" id="send_form"><span class="type-signature"></span>send_form<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Existing for backwards compatibility.</p>
<p>This function simply throws an <code>InternalError</code> when invoked.</p>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="luci.js.html">luci.js</a>, <a href="luci.js.html#line3061">line 3061</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
<p>Throws an <code>InternalError</code> with the message <code>Not implemented</code>
when invoked.</p>
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">InternalError</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
</article>
</section>
</div>
<nav>
<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>
</nav>
<br class="clear">
<footer>
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)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>