5 <title>Source: luci.js</title>
8 <script src="scripts/prettify/prettify.js"></script>
9 <script src="scripts/prettify/lang-css.js"></script>
10 <script src="scripts/jquery.min.js"></script>
12 <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
14 <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
15 <link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css">
16 <link type="text/css" rel="stylesheet" href="styles/jaguar.css">
20 var config = {"monospaceLinks":true,"cleverLinks":true,"default":{"outputSourceFiles":true}};
27 <div id="wrap" class="clearfix">
29 <div class="navigation">
30 <h3 class="applicationName"><a href="index.html"></a></h3>
33 <input id="search" type="text" class="form-control input-sm" placeholder="Search Documentations">
37 <li class="item" data-name="LuCI">
39 <a href="LuCI.html">LuCI</a>
42 <ul class="members itemMembers">
44 <span class="subtitle">Members</span>
46 <li data-name="LuCI#Class"><a href="LuCI.html#Class">Class</a></li>
48 <li data-name="LuCI#dom"><a href="LuCI.html#dom">dom</a></li>
50 <li data-name="LuCI#env"><a href="LuCI.html#env">env</a></li>
52 <li data-name="LuCI#Poll"><a href="LuCI.html#Poll">Poll</a></li>
54 <li data-name="LuCI#Request"><a href="LuCI.html#Request">Request</a></li>
56 <li data-name="LuCI#view"><a href="LuCI.html#view">view</a></li>
59 <ul class="typedefs itemMembers">
61 <span class="subtitle">Typedefs</span>
63 <li data-name="LuCI.requestCallbackFn"><a href="LuCI.html#.requestCallbackFn">requestCallbackFn</a></li>
66 <ul class="typedefs itemMembers">
69 <ul class="methods itemMembers">
71 <span class="subtitle">Methods</span>
73 <li data-name="LuCI#bind"><a href="LuCI.html#bind">bind</a></li>
75 <li data-name="LuCI#error"><a href="LuCI.html#error">error</a></li>
77 <li data-name="LuCI#get"><a href="LuCI.html#get">get</a></li>
79 <li data-name="LuCI#halt"><a href="LuCI.html#halt">halt</a></li>
81 <li data-name="LuCI#hasSystemFeature"><a href="LuCI.html#hasSystemFeature">hasSystemFeature</a></li>
83 <li data-name="LuCI#isObject"><a href="LuCI.html#isObject">isObject</a></li>
85 <li data-name="LuCI#location"><a href="LuCI.html#location">location</a></li>
87 <li data-name="LuCI#media"><a href="LuCI.html#media">media</a></li>
89 <li data-name="LuCI#path"><a href="LuCI.html#path">path</a></li>
91 <li data-name="LuCI#poll"><a href="LuCI.html#poll">poll</a></li>
93 <li data-name="LuCI#post"><a href="LuCI.html#post">post</a></li>
95 <li data-name="LuCI#raise"><a href="LuCI.html#raise">raise</a></li>
97 <li data-name="LuCI#require"><a href="LuCI.html#require">require</a></li>
99 <li data-name="LuCI#resolveDefault"><a href="LuCI.html#resolveDefault">resolveDefault</a></li>
101 <li data-name="LuCI#resource"><a href="LuCI.html#resource">resource</a></li>
103 <li data-name="LuCI#run"><a href="LuCI.html#run">run</a></li>
105 <li data-name="LuCI#sortedKeys"><a href="LuCI.html#sortedKeys">sortedKeys</a></li>
107 <li data-name="LuCI#stop"><a href="LuCI.html#stop">stop</a></li>
109 <li data-name="LuCI#toArray"><a href="LuCI.html#toArray">toArray</a></li>
111 <li data-name="LuCI#url"><a href="LuCI.html#url">url</a></li>
114 <ul class="events itemMembers">
119 <li class="item" data-name="LuCI.baseclass">
121 <a href="LuCI.baseclass.html">LuCI.baseclass</a>
124 <ul class="members itemMembers">
127 <ul class="typedefs itemMembers">
130 <ul class="typedefs itemMembers">
133 <ul class="methods itemMembers">
135 <span class="subtitle">Methods</span>
137 <li data-name="LuCI.baseclass.extend"><a href="LuCI.baseclass.html#.extend">extend</a></li>
139 <li data-name="LuCI.baseclass.instantiate"><a href="LuCI.baseclass.html#.instantiate">instantiate</a></li>
141 <li data-name="LuCI.baseclass.isSubclass"><a href="LuCI.baseclass.html#.isSubclass">isSubclass</a></li>
143 <li data-name="LuCI.baseclass.singleton"><a href="LuCI.baseclass.html#.singleton">singleton</a></li>
145 <li data-name="LuCI.baseclass#super"><a href="LuCI.baseclass.html#super">super</a></li>
147 <li data-name="LuCI.baseclass#varargs"><a href="LuCI.baseclass.html#varargs">varargs</a></li>
150 <ul class="events itemMembers">
155 <li class="item" data-name="LuCI.dom">
157 <a href="LuCI.dom.html">LuCI.dom</a>
160 <ul class="members itemMembers">
163 <ul class="typedefs itemMembers">
165 <span class="subtitle">Typedefs</span>
167 <li data-name="LuCI.dom~ignoreCallbackFn"><a href="LuCI.dom.html#~ignoreCallbackFn">ignoreCallbackFn</a></li>
170 <ul class="typedefs itemMembers">
173 <ul class="methods itemMembers">
175 <span class="subtitle">Methods</span>
177 <li data-name="LuCI.dom#append"><a href="LuCI.dom.html#append">append</a></li>
179 <li data-name="LuCI.dom#attr"><a href="LuCI.dom.html#attr">attr</a></li>
181 <li data-name="LuCI.dom#bindClassInstance"><a href="LuCI.dom.html#bindClassInstance">bindClassInstance</a></li>
183 <li data-name="LuCI.dom#callClassMethod"><a href="LuCI.dom.html#callClassMethod">callClassMethod</a></li>
185 <li data-name="LuCI.dom#content"><a href="LuCI.dom.html#content">content</a></li>
187 <li data-name="LuCI.dom#create"><a href="LuCI.dom.html#create">create</a></li>
189 <li data-name="LuCI.dom#data"><a href="LuCI.dom.html#data">data</a></li>
191 <li data-name="LuCI.dom#elem"><a href="LuCI.dom.html#elem">elem</a></li>
193 <li data-name="LuCI.dom#findClassInstance"><a href="LuCI.dom.html#findClassInstance">findClassInstance</a></li>
195 <li data-name="LuCI.dom#isEmpty"><a href="LuCI.dom.html#isEmpty">isEmpty</a></li>
197 <li data-name="LuCI.dom#matches"><a href="LuCI.dom.html#matches">matches</a></li>
199 <li data-name="LuCI.dom#parent"><a href="LuCI.dom.html#parent">parent</a></li>
201 <li data-name="LuCI.dom#parse"><a href="LuCI.dom.html#parse">parse</a></li>
204 <ul class="events itemMembers">
209 <li class="item" data-name="LuCI.fs">
211 <a href="LuCI.fs.html">LuCI.fs</a>
214 <ul class="members itemMembers">
217 <ul class="typedefs itemMembers">
219 <span class="subtitle">Typedefs</span>
221 <li data-name="LuCI.fs.FileExecResult"><a href="LuCI.fs.html#.FileExecResult">FileExecResult</a></li>
223 <li data-name="LuCI.fs.FileStatEntry"><a href="LuCI.fs.html#.FileStatEntry">FileStatEntry</a></li>
226 <ul class="typedefs itemMembers">
229 <ul class="methods itemMembers">
231 <span class="subtitle">Methods</span>
233 <li data-name="LuCI.fs#exec"><a href="LuCI.fs.html#exec">exec</a></li>
235 <li data-name="LuCI.fs#exec_direct"><a href="LuCI.fs.html#exec_direct">exec_direct</a></li>
237 <li data-name="LuCI.fs#lines"><a href="LuCI.fs.html#lines">lines</a></li>
239 <li data-name="LuCI.fs#list"><a href="LuCI.fs.html#list">list</a></li>
241 <li data-name="LuCI.fs#read"><a href="LuCI.fs.html#read">read</a></li>
243 <li data-name="LuCI.fs#read_direct"><a href="LuCI.fs.html#read_direct">read_direct</a></li>
245 <li data-name="LuCI.fs#remove"><a href="LuCI.fs.html#remove">remove</a></li>
247 <li data-name="LuCI.fs#stat"><a href="LuCI.fs.html#stat">stat</a></li>
249 <li data-name="LuCI.fs#trimmed"><a href="LuCI.fs.html#trimmed">trimmed</a></li>
251 <li data-name="LuCI.fs#write"><a href="LuCI.fs.html#write">write</a></li>
254 <ul class="events itemMembers">
259 <li class="item" data-name="LuCI.headers">
261 <a href="LuCI.headers.html">LuCI.headers</a>
264 <ul class="members itemMembers">
267 <ul class="typedefs itemMembers">
270 <ul class="typedefs itemMembers">
273 <ul class="methods itemMembers">
275 <span class="subtitle">Methods</span>
277 <li data-name="LuCI.headers#get"><a href="LuCI.headers.html#get">get</a></li>
279 <li data-name="LuCI.headers#has"><a href="LuCI.headers.html#has">has</a></li>
282 <ul class="events itemMembers">
287 <li class="item" data-name="LuCI.network">
289 <a href="LuCI.network.html">LuCI.network</a>
292 <ul class="members itemMembers">
295 <ul class="typedefs itemMembers">
297 <span class="subtitle">Typedefs</span>
299 <li data-name="LuCI.network.SwitchTopology"><a href="LuCI.network.html#.SwitchTopology">SwitchTopology</a></li>
301 <li data-name="LuCI.network.WifiEncryption"><a href="LuCI.network.html#.WifiEncryption">WifiEncryption</a></li>
303 <li data-name="LuCI.network.WifiPeerEntry"><a href="LuCI.network.html#.WifiPeerEntry">WifiPeerEntry</a></li>
305 <li data-name="LuCI.network.WifiRateEntry"><a href="LuCI.network.html#.WifiRateEntry">WifiRateEntry</a></li>
307 <li data-name="LuCI.network.WifiScanResult"><a href="LuCI.network.html#.WifiScanResult">WifiScanResult</a></li>
310 <ul class="typedefs itemMembers">
313 <ul class="methods itemMembers">
315 <span class="subtitle">Methods</span>
317 <li data-name="LuCI.network#addNetwork"><a href="LuCI.network.html#addNetwork">addNetwork</a></li>
319 <li data-name="LuCI.network#addWifiNetwork"><a href="LuCI.network.html#addWifiNetwork">addWifiNetwork</a></li>
321 <li data-name="LuCI.network#deleteNetwork"><a href="LuCI.network.html#deleteNetwork">deleteNetwork</a></li>
323 <li data-name="LuCI.network#deleteWifiNetwork"><a href="LuCI.network.html#deleteWifiNetwork">deleteWifiNetwork</a></li>
325 <li data-name="LuCI.network#flushCache"><a href="LuCI.network.html#flushCache">flushCache</a></li>
327 <li data-name="LuCI.network#formatWifiEncryption"><a href="LuCI.network.html#formatWifiEncryption">formatWifiEncryption</a></li>
329 <li data-name="LuCI.network#getDevice"><a href="LuCI.network.html#getDevice">getDevice</a></li>
331 <li data-name="LuCI.network#getDevices"><a href="LuCI.network.html#getDevices">getDevices</a></li>
333 <li data-name="LuCI.network#getDSLModemType"><a href="LuCI.network.html#getDSLModemType">getDSLModemType</a></li>
335 <li data-name="LuCI.network#getHostHints"><a href="LuCI.network.html#getHostHints">getHostHints</a></li>
337 <li data-name="LuCI.network#getIfnameOf"><a href="LuCI.network.html#getIfnameOf">getIfnameOf</a></li>
339 <li data-name="LuCI.network#getNetwork"><a href="LuCI.network.html#getNetwork">getNetwork</a></li>
341 <li data-name="LuCI.network#getNetworks"><a href="LuCI.network.html#getNetworks">getNetworks</a></li>
343 <li data-name="LuCI.network#getProtocol"><a href="LuCI.network.html#getProtocol">getProtocol</a></li>
345 <li data-name="LuCI.network#getProtocols"><a href="LuCI.network.html#getProtocols">getProtocols</a></li>
347 <li data-name="LuCI.network#getSwitchTopologies"><a href="LuCI.network.html#getSwitchTopologies">getSwitchTopologies</a></li>
349 <li data-name="LuCI.network#getWAN6Networks"><a href="LuCI.network.html#getWAN6Networks">getWAN6Networks</a></li>
351 <li data-name="LuCI.network#getWANNetworks"><a href="LuCI.network.html#getWANNetworks">getWANNetworks</a></li>
353 <li data-name="LuCI.network#getWifiDevice"><a href="LuCI.network.html#getWifiDevice">getWifiDevice</a></li>
355 <li data-name="LuCI.network#getWifiDevices"><a href="LuCI.network.html#getWifiDevices">getWifiDevices</a></li>
357 <li data-name="LuCI.network#getWifiNetwork"><a href="LuCI.network.html#getWifiNetwork">getWifiNetwork</a></li>
359 <li data-name="LuCI.network#getWifiNetworks"><a href="LuCI.network.html#getWifiNetworks">getWifiNetworks</a></li>
361 <li data-name="LuCI.network#isIgnoredDevice"><a href="LuCI.network.html#isIgnoredDevice">isIgnoredDevice</a></li>
363 <li data-name="LuCI.network#maskToPrefix"><a href="LuCI.network.html#maskToPrefix">maskToPrefix</a></li>
365 <li data-name="LuCI.network#prefixToMask"><a href="LuCI.network.html#prefixToMask">prefixToMask</a></li>
367 <li data-name="LuCI.network#registerErrorCode"><a href="LuCI.network.html#registerErrorCode">registerErrorCode</a></li>
369 <li data-name="LuCI.network#registerPatternVirtual"><a href="LuCI.network.html#registerPatternVirtual">registerPatternVirtual</a></li>
371 <li data-name="LuCI.network#registerProtocol"><a href="LuCI.network.html#registerProtocol">registerProtocol</a></li>
373 <li data-name="LuCI.network#renameNetwork"><a href="LuCI.network.html#renameNetwork">renameNetwork</a></li>
376 <ul class="events itemMembers">
381 <li class="item" data-name="LuCI.network.Device">
383 <a href="LuCI.network.Device.html">LuCI.network.Device</a>
386 <ul class="members itemMembers">
389 <ul class="typedefs itemMembers">
392 <ul class="typedefs itemMembers">
395 <ul class="methods itemMembers">
397 <span class="subtitle">Methods</span>
399 <li data-name="LuCI.network.Device#getBridgeID"><a href="LuCI.network.Device.html#getBridgeID">getBridgeID</a></li>
401 <li data-name="LuCI.network.Device#getBridgeSTP"><a href="LuCI.network.Device.html#getBridgeSTP">getBridgeSTP</a></li>
403 <li data-name="LuCI.network.Device#getI18n"><a href="LuCI.network.Device.html#getI18n">getI18n</a></li>
405 <li data-name="LuCI.network.Device#getIP6Addrs"><a href="LuCI.network.Device.html#getIP6Addrs">getIP6Addrs</a></li>
407 <li data-name="LuCI.network.Device#getIPAddrs"><a href="LuCI.network.Device.html#getIPAddrs">getIPAddrs</a></li>
409 <li data-name="LuCI.network.Device#getMAC"><a href="LuCI.network.Device.html#getMAC">getMAC</a></li>
411 <li data-name="LuCI.network.Device#getMTU"><a href="LuCI.network.Device.html#getMTU">getMTU</a></li>
413 <li data-name="LuCI.network.Device#getName"><a href="LuCI.network.Device.html#getName">getName</a></li>
415 <li data-name="LuCI.network.Device#getNetwork"><a href="LuCI.network.Device.html#getNetwork">getNetwork</a></li>
417 <li data-name="LuCI.network.Device#getNetworks"><a href="LuCI.network.Device.html#getNetworks">getNetworks</a></li>
419 <li data-name="LuCI.network.Device#getPorts"><a href="LuCI.network.Device.html#getPorts">getPorts</a></li>
421 <li data-name="LuCI.network.Device#getRXBytes"><a href="LuCI.network.Device.html#getRXBytes">getRXBytes</a></li>
423 <li data-name="LuCI.network.Device#getRXPackets"><a href="LuCI.network.Device.html#getRXPackets">getRXPackets</a></li>
425 <li data-name="LuCI.network.Device#getShortName"><a href="LuCI.network.Device.html#getShortName">getShortName</a></li>
427 <li data-name="LuCI.network.Device#getTXBytes"><a href="LuCI.network.Device.html#getTXBytes">getTXBytes</a></li>
429 <li data-name="LuCI.network.Device#getTXPackets"><a href="LuCI.network.Device.html#getTXPackets">getTXPackets</a></li>
431 <li data-name="LuCI.network.Device#getType"><a href="LuCI.network.Device.html#getType">getType</a></li>
433 <li data-name="LuCI.network.Device#getTypeI18n"><a href="LuCI.network.Device.html#getTypeI18n">getTypeI18n</a></li>
435 <li data-name="LuCI.network.Device#getWifiNetwork"><a href="LuCI.network.Device.html#getWifiNetwork">getWifiNetwork</a></li>
437 <li data-name="LuCI.network.Device#isBridge"><a href="LuCI.network.Device.html#isBridge">isBridge</a></li>
439 <li data-name="LuCI.network.Device#isBridgePort"><a href="LuCI.network.Device.html#isBridgePort">isBridgePort</a></li>
441 <li data-name="LuCI.network.Device#isUp"><a href="LuCI.network.Device.html#isUp">isUp</a></li>
444 <ul class="events itemMembers">
449 <li class="item" data-name="LuCI.network.Hosts">
451 <a href="LuCI.network.Hosts.html">LuCI.network.Hosts</a>
454 <ul class="members itemMembers">
457 <ul class="typedefs itemMembers">
460 <ul class="typedefs itemMembers">
463 <ul class="methods itemMembers">
465 <span class="subtitle">Methods</span>
467 <li data-name="LuCI.network.Hosts#getHostnameByIP6Addr"><a href="LuCI.network.Hosts.html#getHostnameByIP6Addr">getHostnameByIP6Addr</a></li>
469 <li data-name="LuCI.network.Hosts#getHostnameByIPAddr"><a href="LuCI.network.Hosts.html#getHostnameByIPAddr">getHostnameByIPAddr</a></li>
471 <li data-name="LuCI.network.Hosts#getHostnameByMACAddr"><a href="LuCI.network.Hosts.html#getHostnameByMACAddr">getHostnameByMACAddr</a></li>
473 <li data-name="LuCI.network.Hosts#getIP6AddrByMACAddr"><a href="LuCI.network.Hosts.html#getIP6AddrByMACAddr">getIP6AddrByMACAddr</a></li>
475 <li data-name="LuCI.network.Hosts#getIPAddrByMACAddr"><a href="LuCI.network.Hosts.html#getIPAddrByMACAddr">getIPAddrByMACAddr</a></li>
477 <li data-name="LuCI.network.Hosts#getMACAddrByIP6Addr"><a href="LuCI.network.Hosts.html#getMACAddrByIP6Addr">getMACAddrByIP6Addr</a></li>
479 <li data-name="LuCI.network.Hosts#getMACAddrByIPAddr"><a href="LuCI.network.Hosts.html#getMACAddrByIPAddr">getMACAddrByIPAddr</a></li>
481 <li data-name="LuCI.network.Hosts#getMACHints"><a href="LuCI.network.Hosts.html#getMACHints">getMACHints</a></li>
484 <ul class="events itemMembers">
489 <li class="item" data-name="LuCI.network.Protocol">
491 <a href="LuCI.network.Protocol.html">LuCI.network.Protocol</a>
494 <ul class="members itemMembers">
497 <ul class="typedefs itemMembers">
500 <ul class="typedefs itemMembers">
503 <ul class="methods itemMembers">
505 <span class="subtitle">Methods</span>
507 <li data-name="LuCI.network.Protocol#addDevice"><a href="LuCI.network.Protocol.html#addDevice">addDevice</a></li>
509 <li data-name="LuCI.network.Protocol#containsDevice"><a href="LuCI.network.Protocol.html#containsDevice">containsDevice</a></li>
511 <li data-name="LuCI.network.Protocol#deleteConfiguration"><a href="LuCI.network.Protocol.html#deleteConfiguration">deleteConfiguration</a></li>
513 <li data-name="LuCI.network.Protocol#deleteDevice"><a href="LuCI.network.Protocol.html#deleteDevice">deleteDevice</a></li>
515 <li data-name="LuCI.network.Protocol#get"><a href="LuCI.network.Protocol.html#get">get</a></li>
517 <li data-name="LuCI.network.Protocol#getDevice"><a href="LuCI.network.Protocol.html#getDevice">getDevice</a></li>
519 <li data-name="LuCI.network.Protocol#getDevices"><a href="LuCI.network.Protocol.html#getDevices">getDevices</a></li>
521 <li data-name="LuCI.network.Protocol#getDNS6Addrs"><a href="LuCI.network.Protocol.html#getDNS6Addrs">getDNS6Addrs</a></li>
523 <li data-name="LuCI.network.Protocol#getDNSAddrs"><a href="LuCI.network.Protocol.html#getDNSAddrs">getDNSAddrs</a></li>
525 <li data-name="LuCI.network.Protocol#getErrors"><a href="LuCI.network.Protocol.html#getErrors">getErrors</a></li>
527 <li data-name="LuCI.network.Protocol#getExpiry"><a href="LuCI.network.Protocol.html#getExpiry">getExpiry</a></li>
529 <li data-name="LuCI.network.Protocol#getGateway6Addr"><a href="LuCI.network.Protocol.html#getGateway6Addr">getGateway6Addr</a></li>
531 <li data-name="LuCI.network.Protocol#getGatewayAddr"><a href="LuCI.network.Protocol.html#getGatewayAddr">getGatewayAddr</a></li>
533 <li data-name="LuCI.network.Protocol#getI18n"><a href="LuCI.network.Protocol.html#getI18n">getI18n</a></li>
535 <li data-name="LuCI.network.Protocol#getIfname"><a href="LuCI.network.Protocol.html#getIfname">getIfname</a></li>
537 <li data-name="LuCI.network.Protocol#getIP6Addr"><a href="LuCI.network.Protocol.html#getIP6Addr">getIP6Addr</a></li>
539 <li data-name="LuCI.network.Protocol#getIP6Addrs"><a href="LuCI.network.Protocol.html#getIP6Addrs">getIP6Addrs</a></li>
541 <li data-name="LuCI.network.Protocol#getIP6Prefix"><a href="LuCI.network.Protocol.html#getIP6Prefix">getIP6Prefix</a></li>
543 <li data-name="LuCI.network.Protocol#getIPAddr"><a href="LuCI.network.Protocol.html#getIPAddr">getIPAddr</a></li>
545 <li data-name="LuCI.network.Protocol#getIPAddrs"><a href="LuCI.network.Protocol.html#getIPAddrs">getIPAddrs</a></li>
547 <li data-name="LuCI.network.Protocol#getL2Device"><a href="LuCI.network.Protocol.html#getL2Device">getL2Device</a></li>
549 <li data-name="LuCI.network.Protocol#getL3Device"><a href="LuCI.network.Protocol.html#getL3Device">getL3Device</a></li>
551 <li data-name="LuCI.network.Protocol#getMetric"><a href="LuCI.network.Protocol.html#getMetric">getMetric</a></li>
553 <li data-name="LuCI.network.Protocol#getName"><a href="LuCI.network.Protocol.html#getName">getName</a></li>
555 <li data-name="LuCI.network.Protocol#getNetmask"><a href="LuCI.network.Protocol.html#getNetmask">getNetmask</a></li>
557 <li data-name="LuCI.network.Protocol#getOpkgPackage"><a href="LuCI.network.Protocol.html#getOpkgPackage">getOpkgPackage</a></li>
559 <li data-name="LuCI.network.Protocol#getProtocol"><a href="LuCI.network.Protocol.html#getProtocol">getProtocol</a></li>
561 <li data-name="LuCI.network.Protocol#getType"><a href="LuCI.network.Protocol.html#getType">getType</a></li>
563 <li data-name="LuCI.network.Protocol#getUptime"><a href="LuCI.network.Protocol.html#getUptime">getUptime</a></li>
565 <li data-name="LuCI.network.Protocol#getZoneName"><a href="LuCI.network.Protocol.html#getZoneName">getZoneName</a></li>
567 <li data-name="LuCI.network.Protocol#isAlias"><a href="LuCI.network.Protocol.html#isAlias">isAlias</a></li>
569 <li data-name="LuCI.network.Protocol#isBridge"><a href="LuCI.network.Protocol.html#isBridge">isBridge</a></li>
571 <li data-name="LuCI.network.Protocol#isDynamic"><a href="LuCI.network.Protocol.html#isDynamic">isDynamic</a></li>
573 <li data-name="LuCI.network.Protocol#isEmpty"><a href="LuCI.network.Protocol.html#isEmpty">isEmpty</a></li>
575 <li data-name="LuCI.network.Protocol#isFloating"><a href="LuCI.network.Protocol.html#isFloating">isFloating</a></li>
577 <li data-name="LuCI.network.Protocol#isInstalled"><a href="LuCI.network.Protocol.html#isInstalled">isInstalled</a></li>
579 <li data-name="LuCI.network.Protocol#isUp"><a href="LuCI.network.Protocol.html#isUp">isUp</a></li>
581 <li data-name="LuCI.network.Protocol#isVirtual"><a href="LuCI.network.Protocol.html#isVirtual">isVirtual</a></li>
583 <li data-name="LuCI.network.Protocol#set"><a href="LuCI.network.Protocol.html#set">set</a></li>
586 <ul class="events itemMembers">
591 <li class="item" data-name="LuCI.network.WifiDevice">
593 <a href="LuCI.network.WifiDevice.html">LuCI.network.WifiDevice</a>
596 <ul class="members itemMembers">
599 <ul class="typedefs itemMembers">
602 <ul class="typedefs itemMembers">
605 <ul class="methods itemMembers">
607 <span class="subtitle">Methods</span>
609 <li data-name="LuCI.network.WifiDevice#addWifiNetwork"><a href="LuCI.network.WifiDevice.html#addWifiNetwork">addWifiNetwork</a></li>
611 <li data-name="LuCI.network.WifiDevice#deleteWifiNetwork"><a href="LuCI.network.WifiDevice.html#deleteWifiNetwork">deleteWifiNetwork</a></li>
613 <li data-name="LuCI.network.WifiDevice#get"><a href="LuCI.network.WifiDevice.html#get">get</a></li>
615 <li data-name="LuCI.network.WifiDevice#getHTModes"><a href="LuCI.network.WifiDevice.html#getHTModes">getHTModes</a></li>
617 <li data-name="LuCI.network.WifiDevice#getHWModes"><a href="LuCI.network.WifiDevice.html#getHWModes">getHWModes</a></li>
619 <li data-name="LuCI.network.WifiDevice#getI18n"><a href="LuCI.network.WifiDevice.html#getI18n">getI18n</a></li>
621 <li data-name="LuCI.network.WifiDevice#getName"><a href="LuCI.network.WifiDevice.html#getName">getName</a></li>
623 <li data-name="LuCI.network.WifiDevice#getScanList"><a href="LuCI.network.WifiDevice.html#getScanList">getScanList</a></li>
625 <li data-name="LuCI.network.WifiDevice#getWifiNetwork"><a href="LuCI.network.WifiDevice.html#getWifiNetwork">getWifiNetwork</a></li>
627 <li data-name="LuCI.network.WifiDevice#getWifiNetworks"><a href="LuCI.network.WifiDevice.html#getWifiNetworks">getWifiNetworks</a></li>
629 <li data-name="LuCI.network.WifiDevice#isDisabled"><a href="LuCI.network.WifiDevice.html#isDisabled">isDisabled</a></li>
631 <li data-name="LuCI.network.WifiDevice#isUp"><a href="LuCI.network.WifiDevice.html#isUp">isUp</a></li>
633 <li data-name="LuCI.network.WifiDevice#set"><a href="LuCI.network.WifiDevice.html#set">set</a></li>
636 <ul class="events itemMembers">
641 <li class="item" data-name="LuCI.network.WifiNetwork">
643 <a href="LuCI.network.WifiNetwork.html">LuCI.network.WifiNetwork</a>
646 <ul class="members itemMembers">
649 <ul class="typedefs itemMembers">
652 <ul class="typedefs itemMembers">
655 <ul class="methods itemMembers">
657 <span class="subtitle">Methods</span>
659 <li data-name="LuCI.network.WifiNetwork#disconnectClient"><a href="LuCI.network.WifiNetwork.html#disconnectClient">disconnectClient</a></li>
661 <li data-name="LuCI.network.WifiNetwork#get"><a href="LuCI.network.WifiNetwork.html#get">get</a></li>
663 <li data-name="LuCI.network.WifiNetwork#getActiveBSSID"><a href="LuCI.network.WifiNetwork.html#getActiveBSSID">getActiveBSSID</a></li>
665 <li data-name="LuCI.network.WifiNetwork#getActiveEncryption"><a href="LuCI.network.WifiNetwork.html#getActiveEncryption">getActiveEncryption</a></li>
667 <li data-name="LuCI.network.WifiNetwork#getActiveMode"><a href="LuCI.network.WifiNetwork.html#getActiveMode">getActiveMode</a></li>
669 <li data-name="LuCI.network.WifiNetwork#getActiveModeI18n"><a href="LuCI.network.WifiNetwork.html#getActiveModeI18n">getActiveModeI18n</a></li>
671 <li data-name="LuCI.network.WifiNetwork#getActiveSSID"><a href="LuCI.network.WifiNetwork.html#getActiveSSID">getActiveSSID</a></li>
673 <li data-name="LuCI.network.WifiNetwork#getAssocList"><a href="LuCI.network.WifiNetwork.html#getAssocList">getAssocList</a></li>
675 <li data-name="LuCI.network.WifiNetwork#getBitRate"><a href="LuCI.network.WifiNetwork.html#getBitRate">getBitRate</a></li>
677 <li data-name="LuCI.network.WifiNetwork#getBSSID"><a href="LuCI.network.WifiNetwork.html#getBSSID">getBSSID</a></li>
679 <li data-name="LuCI.network.WifiNetwork#getChannel"><a href="LuCI.network.WifiNetwork.html#getChannel">getChannel</a></li>
681 <li data-name="LuCI.network.WifiNetwork#getCountryCode"><a href="LuCI.network.WifiNetwork.html#getCountryCode">getCountryCode</a></li>
683 <li data-name="LuCI.network.WifiNetwork#getDevice"><a href="LuCI.network.WifiNetwork.html#getDevice">getDevice</a></li>
685 <li data-name="LuCI.network.WifiNetwork#getFrequency"><a href="LuCI.network.WifiNetwork.html#getFrequency">getFrequency</a></li>
687 <li data-name="LuCI.network.WifiNetwork#getI18n"><a href="LuCI.network.WifiNetwork.html#getI18n">getI18n</a></li>
689 <li data-name="LuCI.network.WifiNetwork#getID"><a href="LuCI.network.WifiNetwork.html#getID">getID</a></li>
691 <li data-name="LuCI.network.WifiNetwork#getIfname"><a href="LuCI.network.WifiNetwork.html#getIfname">getIfname</a></li>
693 <li data-name="LuCI.network.WifiNetwork#getMeshID"><a href="LuCI.network.WifiNetwork.html#getMeshID">getMeshID</a></li>
695 <li data-name="LuCI.network.WifiNetwork#getMode"><a href="LuCI.network.WifiNetwork.html#getMode">getMode</a></li>
697 <li data-name="LuCI.network.WifiNetwork#getName"><a href="LuCI.network.WifiNetwork.html#getName">getName</a></li>
699 <li data-name="LuCI.network.WifiNetwork#getNetwork"><a href="LuCI.network.WifiNetwork.html#getNetwork">getNetwork</a></li>
701 <li data-name="LuCI.network.WifiNetwork#getNetworkNames"><a href="LuCI.network.WifiNetwork.html#getNetworkNames">getNetworkNames</a></li>
703 <li data-name="LuCI.network.WifiNetwork#getNetworks"><a href="LuCI.network.WifiNetwork.html#getNetworks">getNetworks</a></li>
705 <li data-name="LuCI.network.WifiNetwork#getNoise"><a href="LuCI.network.WifiNetwork.html#getNoise">getNoise</a></li>
707 <li data-name="LuCI.network.WifiNetwork#getShortName"><a href="LuCI.network.WifiNetwork.html#getShortName">getShortName</a></li>
709 <li data-name="LuCI.network.WifiNetwork#getSignal"><a href="LuCI.network.WifiNetwork.html#getSignal">getSignal</a></li>
711 <li data-name="LuCI.network.WifiNetwork#getSignalLevel"><a href="LuCI.network.WifiNetwork.html#getSignalLevel">getSignalLevel</a></li>
713 <li data-name="LuCI.network.WifiNetwork#getSignalPercent"><a href="LuCI.network.WifiNetwork.html#getSignalPercent">getSignalPercent</a></li>
715 <li data-name="LuCI.network.WifiNetwork#getSSID"><a href="LuCI.network.WifiNetwork.html#getSSID">getSSID</a></li>
717 <li data-name="LuCI.network.WifiNetwork#getTXPower"><a href="LuCI.network.WifiNetwork.html#getTXPower">getTXPower</a></li>
719 <li data-name="LuCI.network.WifiNetwork#getTXPowerOffset"><a href="LuCI.network.WifiNetwork.html#getTXPowerOffset">getTXPowerOffset</a></li>
721 <li data-name="LuCI.network.WifiNetwork#getWifiDevice"><a href="LuCI.network.WifiNetwork.html#getWifiDevice">getWifiDevice</a></li>
723 <li data-name="LuCI.network.WifiNetwork#getWifiDeviceName"><a href="LuCI.network.WifiNetwork.html#getWifiDeviceName">getWifiDeviceName</a></li>
725 <li data-name="LuCI.network.WifiNetwork#isClientDisconnectSupported"><a href="LuCI.network.WifiNetwork.html#isClientDisconnectSupported">isClientDisconnectSupported</a></li>
727 <li data-name="LuCI.network.WifiNetwork#isDisabled"><a href="LuCI.network.WifiNetwork.html#isDisabled">isDisabled</a></li>
729 <li data-name="LuCI.network.WifiNetwork#isUp"><a href="LuCI.network.WifiNetwork.html#isUp">isUp</a></li>
731 <li data-name="LuCI.network.WifiNetwork#set"><a href="LuCI.network.WifiNetwork.html#set">set</a></li>
734 <ul class="events itemMembers">
739 <li class="item" data-name="LuCI.poll">
741 <a href="LuCI.poll.html">LuCI.poll</a>
744 <ul class="members itemMembers">
747 <ul class="typedefs itemMembers">
750 <ul class="typedefs itemMembers">
753 <ul class="methods itemMembers">
755 <span class="subtitle">Methods</span>
757 <li data-name="LuCI.poll#active"><a href="LuCI.poll.html#active">active</a></li>
759 <li data-name="LuCI.poll#add"><a href="LuCI.poll.html#add">add</a></li>
761 <li data-name="LuCI.poll#remove"><a href="LuCI.poll.html#remove">remove</a></li>
763 <li data-name="LuCI.poll#start"><a href="LuCI.poll.html#start">start</a></li>
765 <li data-name="LuCI.poll#stop"><a href="LuCI.poll.html#stop">stop</a></li>
768 <ul class="events itemMembers">
773 <li class="item" data-name="LuCI.request">
775 <a href="LuCI.request.html">LuCI.request</a>
778 <ul class="members itemMembers">
781 <ul class="typedefs itemMembers">
783 <span class="subtitle">Typedefs</span>
785 <li data-name="LuCI.request.interceptorFn"><a href="LuCI.request.html#.interceptorFn">interceptorFn</a></li>
787 <li data-name="LuCI.request.RequestOptions"><a href="LuCI.request.html#.RequestOptions">RequestOptions</a></li>
790 <ul class="typedefs itemMembers">
793 <ul class="methods itemMembers">
795 <span class="subtitle">Methods</span>
797 <li data-name="LuCI.request#addInterceptor"><a href="LuCI.request.html#addInterceptor">addInterceptor</a></li>
799 <li data-name="LuCI.request#expandURL"><a href="LuCI.request.html#expandURL">expandURL</a></li>
801 <li data-name="LuCI.request#get"><a href="LuCI.request.html#get">get</a></li>
803 <li data-name="LuCI.request#post"><a href="LuCI.request.html#post">post</a></li>
805 <li data-name="LuCI.request#removeInterceptor"><a href="LuCI.request.html#removeInterceptor">removeInterceptor</a></li>
807 <li data-name="LuCI.request#request"><a href="LuCI.request.html#request">request</a></li>
810 <ul class="events itemMembers">
815 <li class="item" data-name="LuCI.request.poll">
817 <a href="LuCI.request.poll.html">LuCI.request.poll</a>
820 <ul class="members itemMembers">
823 <ul class="typedefs itemMembers">
825 <span class="subtitle">Typedefs</span>
827 <li data-name="LuCI.request.poll~callbackFn"><a href="LuCI.request.poll.html#~callbackFn">callbackFn</a></li>
830 <ul class="typedefs itemMembers">
833 <ul class="methods itemMembers">
835 <span class="subtitle">Methods</span>
837 <li data-name="LuCI.request.poll#active"><a href="LuCI.request.poll.html#active">active</a></li>
839 <li data-name="LuCI.request.poll#add"><a href="LuCI.request.poll.html#add">add</a></li>
841 <li data-name="LuCI.request.poll#remove"><a href="LuCI.request.poll.html#remove">remove</a></li>
843 <li data-name="LuCI.request.poll#start"><a href="LuCI.request.poll.html#start">start</a></li>
845 <li data-name="LuCI.request.poll#stop"><a href="LuCI.request.poll.html#stop">stop</a></li>
848 <ul class="events itemMembers">
853 <li class="item" data-name="LuCI.response">
855 <a href="LuCI.response.html">LuCI.response</a>
858 <ul class="members itemMembers">
860 <span class="subtitle">Members</span>
862 <li data-name="LuCI.response#duration"><a href="LuCI.response.html#duration">duration</a></li>
864 <li data-name="LuCI.response#headers"><a href="LuCI.response.html#headers">headers</a></li>
866 <li data-name="LuCI.response#ok"><a href="LuCI.response.html#ok">ok</a></li>
868 <li data-name="LuCI.response#status"><a href="LuCI.response.html#status">status</a></li>
870 <li data-name="LuCI.response#statusText"><a href="LuCI.response.html#statusText">statusText</a></li>
872 <li data-name="LuCI.response#url"><a href="LuCI.response.html#url">url</a></li>
875 <ul class="typedefs itemMembers">
878 <ul class="typedefs itemMembers">
881 <ul class="methods itemMembers">
883 <span class="subtitle">Methods</span>
885 <li data-name="LuCI.response#blob"><a href="LuCI.response.html#blob">blob</a></li>
887 <li data-name="LuCI.response#clone"><a href="LuCI.response.html#clone">clone</a></li>
889 <li data-name="LuCI.response#json"><a href="LuCI.response.html#json">json</a></li>
891 <li data-name="LuCI.response#text"><a href="LuCI.response.html#text">text</a></li>
894 <ul class="events itemMembers">
899 <li class="item" data-name="LuCI.rpc">
901 <a href="LuCI.rpc.html">LuCI.rpc</a>
904 <ul class="members itemMembers">
907 <ul class="typedefs itemMembers">
909 <span class="subtitle">Typedefs</span>
911 <li data-name="LuCI.rpc.DeclareOptions"><a href="LuCI.rpc.html#.DeclareOptions">DeclareOptions</a></li>
913 <li data-name="LuCI.rpc~filterFn"><a href="LuCI.rpc.html#~filterFn">filterFn</a></li>
915 <li data-name="LuCI.rpc~interceptorFn"><a href="LuCI.rpc.html#~interceptorFn">interceptorFn</a></li>
917 <li data-name="LuCI.rpc~invokeFn"><a href="LuCI.rpc.html#~invokeFn">invokeFn</a></li>
920 <ul class="typedefs itemMembers">
923 <ul class="methods itemMembers">
925 <span class="subtitle">Methods</span>
927 <li data-name="LuCI.rpc#addInterceptor"><a href="LuCI.rpc.html#addInterceptor">addInterceptor</a></li>
929 <li data-name="LuCI.rpc#declare"><a href="LuCI.rpc.html#declare">declare</a></li>
931 <li data-name="LuCI.rpc#getBaseURL"><a href="LuCI.rpc.html#getBaseURL">getBaseURL</a></li>
933 <li data-name="LuCI.rpc#getSessionID"><a href="LuCI.rpc.html#getSessionID">getSessionID</a></li>
935 <li data-name="LuCI.rpc#getStatusText"><a href="LuCI.rpc.html#getStatusText">getStatusText</a></li>
937 <li data-name="LuCI.rpc#list"><a href="LuCI.rpc.html#list">list</a></li>
939 <li data-name="LuCI.rpc#removeInterceptor"><a href="LuCI.rpc.html#removeInterceptor">removeInterceptor</a></li>
941 <li data-name="LuCI.rpc#setBaseURL"><a href="LuCI.rpc.html#setBaseURL">setBaseURL</a></li>
943 <li data-name="LuCI.rpc#setSessionID"><a href="LuCI.rpc.html#setSessionID">setSessionID</a></li>
946 <ul class="events itemMembers">
951 <li class="item" data-name="LuCI.uci">
953 <a href="LuCI.uci.html">LuCI.uci</a>
956 <ul class="members itemMembers">
959 <ul class="typedefs itemMembers">
961 <span class="subtitle">Typedefs</span>
963 <li data-name="LuCI.uci.ChangeRecord"><a href="LuCI.uci.html#.ChangeRecord">ChangeRecord</a></li>
965 <li data-name="LuCI.uci.SectionObject"><a href="LuCI.uci.html#.SectionObject">SectionObject</a></li>
967 <li data-name="LuCI.uci~sectionsFn"><a href="LuCI.uci.html#~sectionsFn">sectionsFn</a></li>
970 <ul class="typedefs itemMembers">
973 <ul class="methods itemMembers">
975 <span class="subtitle">Methods</span>
977 <li data-name="LuCI.uci#add"><a href="LuCI.uci.html#add">add</a></li>
979 <li data-name="LuCI.uci#apply"><a href="LuCI.uci.html#apply">apply</a></li>
981 <li data-name="LuCI.uci#changes"><a href="LuCI.uci.html#changes">changes</a></li>
983 <li data-name="LuCI.uci#createSID"><a href="LuCI.uci.html#createSID">createSID</a></li>
985 <li data-name="LuCI.uci#get"><a href="LuCI.uci.html#get">get</a></li>
987 <li data-name="LuCI.uci#get_first"><a href="LuCI.uci.html#get_first">get_first</a></li>
989 <li data-name="LuCI.uci#load"><a href="LuCI.uci.html#load">load</a></li>
991 <li data-name="LuCI.uci#move"><a href="LuCI.uci.html#move">move</a></li>
993 <li data-name="LuCI.uci#remove"><a href="LuCI.uci.html#remove">remove</a></li>
995 <li data-name="LuCI.uci#resolveSID"><a href="LuCI.uci.html#resolveSID">resolveSID</a></li>
997 <li data-name="LuCI.uci#save"><a href="LuCI.uci.html#save">save</a></li>
999 <li data-name="LuCI.uci#sections"><a href="LuCI.uci.html#sections">sections</a></li>
1001 <li data-name="LuCI.uci#set"><a href="LuCI.uci.html#set">set</a></li>
1003 <li data-name="LuCI.uci#set_first"><a href="LuCI.uci.html#set_first">set_first</a></li>
1005 <li data-name="LuCI.uci#unload"><a href="LuCI.uci.html#unload">unload</a></li>
1007 <li data-name="LuCI.uci#unset"><a href="LuCI.uci.html#unset">unset</a></li>
1009 <li data-name="LuCI.uci#unset_first"><a href="LuCI.uci.html#unset_first">unset_first</a></li>
1012 <ul class="events itemMembers">
1017 <li class="item" data-name="LuCI.ui">
1018 <span class="title">
1019 <a href="LuCI.ui.html">LuCI.ui</a>
1022 <ul class="members itemMembers">
1025 <ul class="typedefs itemMembers">
1027 <span class="subtitle">Typedefs</span>
1029 <li data-name="LuCI.ui.FileUploadReply"><a href="LuCI.ui.html#.FileUploadReply">FileUploadReply</a></li>
1032 <ul class="typedefs itemMembers">
1035 <ul class="methods itemMembers">
1037 <span class="subtitle">Methods</span>
1039 <li data-name="LuCI.ui#addNotification"><a href="LuCI.ui.html#addNotification">addNotification</a></li>
1041 <li data-name="LuCI.ui#addValidator"><a href="LuCI.ui.html#addValidator">addValidator</a></li>
1043 <li data-name="LuCI.ui#awaitReconnect"><a href="LuCI.ui.html#awaitReconnect">awaitReconnect</a></li>
1045 <li data-name="LuCI.ui#createHandlerFn"><a href="LuCI.ui.html#createHandlerFn">createHandlerFn</a></li>
1047 <li data-name="LuCI.ui#hideIndicator"><a href="LuCI.ui.html#hideIndicator">hideIndicator</a></li>
1049 <li data-name="LuCI.ui#hideModal"><a href="LuCI.ui.html#hideModal">hideModal</a></li>
1051 <li data-name="LuCI.ui#instantiateView"><a href="LuCI.ui.html#instantiateView">instantiateView</a></li>
1053 <li data-name="LuCI.ui#itemlist"><a href="LuCI.ui.html#itemlist">itemlist</a></li>
1055 <li data-name="LuCI.ui#pingDevice"><a href="LuCI.ui.html#pingDevice">pingDevice</a></li>
1057 <li data-name="LuCI.ui#showIndicator"><a href="LuCI.ui.html#showIndicator">showIndicator</a></li>
1059 <li data-name="LuCI.ui#showModal"><a href="LuCI.ui.html#showModal">showModal</a></li>
1061 <li data-name="LuCI.ui#uploadFile"><a href="LuCI.ui.html#uploadFile">uploadFile</a></li>
1064 <ul class="events itemMembers">
1069 <li class="item" data-name="LuCI.ui.AbstractElement">
1070 <span class="title">
1071 <a href="LuCI.ui.AbstractElement.html">LuCI.ui.AbstractElement</a>
1074 <ul class="members itemMembers">
1077 <ul class="typedefs itemMembers">
1079 <span class="subtitle">Typedefs</span>
1081 <li data-name="LuCI.ui.AbstractElement.InitOptions"><a href="LuCI.ui.AbstractElement.html#.InitOptions">InitOptions</a></li>
1084 <ul class="typedefs itemMembers">
1087 <ul class="methods itemMembers">
1089 <span class="subtitle">Methods</span>
1091 <li data-name="LuCI.ui.AbstractElement#getValue"><a href="LuCI.ui.AbstractElement.html#getValue">getValue</a></li>
1093 <li data-name="LuCI.ui.AbstractElement#isValid"><a href="LuCI.ui.AbstractElement.html#isValid">isValid</a></li>
1095 <li data-name="LuCI.ui.AbstractElement#registerEvents"><a href="LuCI.ui.AbstractElement.html#registerEvents">registerEvents</a></li>
1097 <li data-name="LuCI.ui.AbstractElement#render"><a href="LuCI.ui.AbstractElement.html#render">render</a></li>
1099 <li data-name="LuCI.ui.AbstractElement#setChangeEvents"><a href="LuCI.ui.AbstractElement.html#setChangeEvents">setChangeEvents</a></li>
1101 <li data-name="LuCI.ui.AbstractElement#setUpdateEvents"><a href="LuCI.ui.AbstractElement.html#setUpdateEvents">setUpdateEvents</a></li>
1103 <li data-name="LuCI.ui.AbstractElement#setValue"><a href="LuCI.ui.AbstractElement.html#setValue">setValue</a></li>
1105 <li data-name="LuCI.ui.AbstractElement#triggerValidation"><a href="LuCI.ui.AbstractElement.html#triggerValidation">triggerValidation</a></li>
1108 <ul class="events itemMembers">
1113 <li class="item" data-name="LuCI.ui.changes">
1114 <span class="title">
1115 <a href="LuCI.ui.changes.html">LuCI.ui.changes</a>
1118 <ul class="members itemMembers">
1121 <ul class="typedefs itemMembers">
1124 <ul class="typedefs itemMembers">
1127 <ul class="methods itemMembers">
1129 <span class="subtitle">Methods</span>
1131 <li data-name="LuCI.ui.changes#apply"><a href="LuCI.ui.changes.html#apply">apply</a></li>
1133 <li data-name="LuCI.ui.changes#displayChanges"><a href="LuCI.ui.changes.html#displayChanges">displayChanges</a></li>
1135 <li data-name="LuCI.ui.changes#renderChangeIndicator"><a href="LuCI.ui.changes.html#renderChangeIndicator">renderChangeIndicator</a></li>
1137 <li data-name="LuCI.ui.changes#revert"><a href="LuCI.ui.changes.html#revert">revert</a></li>
1139 <li data-name="LuCI.ui.changes#setIndicator"><a href="LuCI.ui.changes.html#setIndicator">setIndicator</a></li>
1142 <ul class="events itemMembers">
1147 <li class="item" data-name="LuCI.ui.Checkbox">
1148 <span class="title">
1149 <a href="LuCI.ui.Checkbox.html">LuCI.ui.Checkbox</a>
1152 <ul class="members itemMembers">
1155 <ul class="typedefs itemMembers">
1157 <span class="subtitle">Typedefs</span>
1159 <li data-name="LuCI.ui.Checkbox.InitOptions"><a href="LuCI.ui.Checkbox.html#.InitOptions">InitOptions</a></li>
1162 <ul class="typedefs itemMembers">
1165 <ul class="methods itemMembers">
1167 <span class="subtitle">Methods</span>
1169 <li data-name="LuCI.ui.Checkbox#getValue"><a href="LuCI.ui.Checkbox.html#getValue">getValue</a></li>
1171 <li data-name="LuCI.ui.Checkbox#isChecked"><a href="LuCI.ui.Checkbox.html#isChecked">isChecked</a></li>
1173 <li data-name="LuCI.ui.Checkbox#isValid"><a href="LuCI.ui.Checkbox.html#isValid">isValid</a></li>
1175 <li data-name="LuCI.ui.Checkbox#registerEvents"><a href="LuCI.ui.Checkbox.html#registerEvents">registerEvents</a></li>
1177 <li data-name="LuCI.ui.Checkbox#render"><a href="LuCI.ui.Checkbox.html#render">render</a></li>
1179 <li data-name="LuCI.ui.Checkbox#setChangeEvents"><a href="LuCI.ui.Checkbox.html#setChangeEvents">setChangeEvents</a></li>
1181 <li data-name="LuCI.ui.Checkbox#setUpdateEvents"><a href="LuCI.ui.Checkbox.html#setUpdateEvents">setUpdateEvents</a></li>
1183 <li data-name="LuCI.ui.Checkbox#setValue"><a href="LuCI.ui.Checkbox.html#setValue">setValue</a></li>
1185 <li data-name="LuCI.ui.Checkbox#triggerValidation"><a href="LuCI.ui.Checkbox.html#triggerValidation">triggerValidation</a></li>
1188 <ul class="events itemMembers">
1193 <li class="item" data-name="LuCI.ui.Combobox">
1194 <span class="title">
1195 <a href="LuCI.ui.Combobox.html">LuCI.ui.Combobox</a>
1198 <ul class="members itemMembers">
1201 <ul class="typedefs itemMembers">
1203 <span class="subtitle">Typedefs</span>
1205 <li data-name="LuCI.ui.Combobox.InitOptions"><a href="LuCI.ui.Combobox.html#.InitOptions">InitOptions</a></li>
1208 <ul class="typedefs itemMembers">
1211 <ul class="methods itemMembers">
1213 <span class="subtitle">Methods</span>
1215 <li data-name="LuCI.ui.Combobox#addChoices"><a href="LuCI.ui.Combobox.html#addChoices">addChoices</a></li>
1217 <li data-name="LuCI.ui.Combobox#clearChoices"><a href="LuCI.ui.Combobox.html#clearChoices">clearChoices</a></li>
1219 <li data-name="LuCI.ui.Combobox#closeAllDropdowns"><a href="LuCI.ui.Combobox.html#closeAllDropdowns">closeAllDropdowns</a></li>
1221 <li data-name="LuCI.ui.Combobox#isValid"><a href="LuCI.ui.Combobox.html#isValid">isValid</a></li>
1223 <li data-name="LuCI.ui.Combobox#registerEvents"><a href="LuCI.ui.Combobox.html#registerEvents">registerEvents</a></li>
1225 <li data-name="LuCI.ui.Combobox#setChangeEvents"><a href="LuCI.ui.Combobox.html#setChangeEvents">setChangeEvents</a></li>
1227 <li data-name="LuCI.ui.Combobox#setUpdateEvents"><a href="LuCI.ui.Combobox.html#setUpdateEvents">setUpdateEvents</a></li>
1229 <li data-name="LuCI.ui.Combobox#triggerValidation"><a href="LuCI.ui.Combobox.html#triggerValidation">triggerValidation</a></li>
1232 <ul class="events itemMembers">
1237 <li class="item" data-name="LuCI.ui.ComboButton">
1238 <span class="title">
1239 <a href="LuCI.ui.ComboButton.html">LuCI.ui.ComboButton</a>
1242 <ul class="members itemMembers">
1245 <ul class="typedefs itemMembers">
1247 <span class="subtitle">Typedefs</span>
1249 <li data-name="LuCI.ui.ComboButton.InitOptions"><a href="LuCI.ui.ComboButton.html#.InitOptions">InitOptions</a></li>
1252 <ul class="typedefs itemMembers">
1255 <ul class="methods itemMembers">
1257 <span class="subtitle">Methods</span>
1259 <li data-name="LuCI.ui.ComboButton#addChoices"><a href="LuCI.ui.ComboButton.html#addChoices">addChoices</a></li>
1261 <li data-name="LuCI.ui.ComboButton#clearChoices"><a href="LuCI.ui.ComboButton.html#clearChoices">clearChoices</a></li>
1263 <li data-name="LuCI.ui.ComboButton#closeAllDropdowns"><a href="LuCI.ui.ComboButton.html#closeAllDropdowns">closeAllDropdowns</a></li>
1265 <li data-name="LuCI.ui.ComboButton#isValid"><a href="LuCI.ui.ComboButton.html#isValid">isValid</a></li>
1267 <li data-name="LuCI.ui.ComboButton#registerEvents"><a href="LuCI.ui.ComboButton.html#registerEvents">registerEvents</a></li>
1269 <li data-name="LuCI.ui.ComboButton#setChangeEvents"><a href="LuCI.ui.ComboButton.html#setChangeEvents">setChangeEvents</a></li>
1271 <li data-name="LuCI.ui.ComboButton#setUpdateEvents"><a href="LuCI.ui.ComboButton.html#setUpdateEvents">setUpdateEvents</a></li>
1273 <li data-name="LuCI.ui.ComboButton#triggerValidation"><a href="LuCI.ui.ComboButton.html#triggerValidation">triggerValidation</a></li>
1276 <ul class="events itemMembers">
1281 <li class="item" data-name="LuCI.ui.Dropdown">
1282 <span class="title">
1283 <a href="LuCI.ui.Dropdown.html">LuCI.ui.Dropdown</a>
1286 <ul class="members itemMembers">
1289 <ul class="typedefs itemMembers">
1291 <span class="subtitle">Typedefs</span>
1293 <li data-name="LuCI.ui.Dropdown.InitOptions"><a href="LuCI.ui.Dropdown.html#.InitOptions">InitOptions</a></li>
1296 <ul class="typedefs itemMembers">
1299 <ul class="methods itemMembers">
1301 <span class="subtitle">Methods</span>
1303 <li data-name="LuCI.ui.Dropdown#addChoices"><a href="LuCI.ui.Dropdown.html#addChoices">addChoices</a></li>
1305 <li data-name="LuCI.ui.Dropdown#clearChoices"><a href="LuCI.ui.Dropdown.html#clearChoices">clearChoices</a></li>
1307 <li data-name="LuCI.ui.Dropdown#closeAllDropdowns"><a href="LuCI.ui.Dropdown.html#closeAllDropdowns">closeAllDropdowns</a></li>
1309 <li data-name="LuCI.ui.Dropdown#getValue"><a href="LuCI.ui.Dropdown.html#getValue">getValue</a></li>
1311 <li data-name="LuCI.ui.Dropdown#isValid"><a href="LuCI.ui.Dropdown.html#isValid">isValid</a></li>
1313 <li data-name="LuCI.ui.Dropdown#registerEvents"><a href="LuCI.ui.Dropdown.html#registerEvents">registerEvents</a></li>
1315 <li data-name="LuCI.ui.Dropdown#render"><a href="LuCI.ui.Dropdown.html#render">render</a></li>
1317 <li data-name="LuCI.ui.Dropdown#setChangeEvents"><a href="LuCI.ui.Dropdown.html#setChangeEvents">setChangeEvents</a></li>
1319 <li data-name="LuCI.ui.Dropdown#setUpdateEvents"><a href="LuCI.ui.Dropdown.html#setUpdateEvents">setUpdateEvents</a></li>
1321 <li data-name="LuCI.ui.Dropdown#setValue"><a href="LuCI.ui.Dropdown.html#setValue">setValue</a></li>
1323 <li data-name="LuCI.ui.Dropdown#triggerValidation"><a href="LuCI.ui.Dropdown.html#triggerValidation">triggerValidation</a></li>
1326 <ul class="events itemMembers">
1331 <li class="item" data-name="LuCI.ui.DynamicList">
1332 <span class="title">
1333 <a href="LuCI.ui.DynamicList.html">LuCI.ui.DynamicList</a>
1336 <ul class="members itemMembers">
1339 <ul class="typedefs itemMembers">
1341 <span class="subtitle">Typedefs</span>
1343 <li data-name="LuCI.ui.DynamicList.InitOptions"><a href="LuCI.ui.DynamicList.html#.InitOptions">InitOptions</a></li>
1346 <ul class="typedefs itemMembers">
1349 <ul class="methods itemMembers">
1351 <span class="subtitle">Methods</span>
1353 <li data-name="LuCI.ui.DynamicList#addChoices"><a href="LuCI.ui.DynamicList.html#addChoices">addChoices</a></li>
1355 <li data-name="LuCI.ui.DynamicList#clearChoices"><a href="LuCI.ui.DynamicList.html#clearChoices">clearChoices</a></li>
1357 <li data-name="LuCI.ui.DynamicList#getValue"><a href="LuCI.ui.DynamicList.html#getValue">getValue</a></li>
1359 <li data-name="LuCI.ui.DynamicList#isValid"><a href="LuCI.ui.DynamicList.html#isValid">isValid</a></li>
1361 <li data-name="LuCI.ui.DynamicList#registerEvents"><a href="LuCI.ui.DynamicList.html#registerEvents">registerEvents</a></li>
1363 <li data-name="LuCI.ui.DynamicList#render"><a href="LuCI.ui.DynamicList.html#render">render</a></li>
1365 <li data-name="LuCI.ui.DynamicList#setChangeEvents"><a href="LuCI.ui.DynamicList.html#setChangeEvents">setChangeEvents</a></li>
1367 <li data-name="LuCI.ui.DynamicList#setUpdateEvents"><a href="LuCI.ui.DynamicList.html#setUpdateEvents">setUpdateEvents</a></li>
1369 <li data-name="LuCI.ui.DynamicList#setValue"><a href="LuCI.ui.DynamicList.html#setValue">setValue</a></li>
1371 <li data-name="LuCI.ui.DynamicList#triggerValidation"><a href="LuCI.ui.DynamicList.html#triggerValidation">triggerValidation</a></li>
1374 <ul class="events itemMembers">
1379 <li class="item" data-name="LuCI.ui.FileUpload">
1380 <span class="title">
1381 <a href="LuCI.ui.FileUpload.html">LuCI.ui.FileUpload</a>
1384 <ul class="members itemMembers">
1387 <ul class="typedefs itemMembers">
1389 <span class="subtitle">Typedefs</span>
1391 <li data-name="LuCI.ui.FileUpload.InitOptions"><a href="LuCI.ui.FileUpload.html#.InitOptions">InitOptions</a></li>
1394 <ul class="typedefs itemMembers">
1397 <ul class="methods itemMembers">
1399 <span class="subtitle">Methods</span>
1401 <li data-name="LuCI.ui.FileUpload#getValue"><a href="LuCI.ui.FileUpload.html#getValue">getValue</a></li>
1403 <li data-name="LuCI.ui.FileUpload#isValid"><a href="LuCI.ui.FileUpload.html#isValid">isValid</a></li>
1405 <li data-name="LuCI.ui.FileUpload#registerEvents"><a href="LuCI.ui.FileUpload.html#registerEvents">registerEvents</a></li>
1407 <li data-name="LuCI.ui.FileUpload#render"><a href="LuCI.ui.FileUpload.html#render">render</a></li>
1409 <li data-name="LuCI.ui.FileUpload#setChangeEvents"><a href="LuCI.ui.FileUpload.html#setChangeEvents">setChangeEvents</a></li>
1411 <li data-name="LuCI.ui.FileUpload#setUpdateEvents"><a href="LuCI.ui.FileUpload.html#setUpdateEvents">setUpdateEvents</a></li>
1413 <li data-name="LuCI.ui.FileUpload#setValue"><a href="LuCI.ui.FileUpload.html#setValue">setValue</a></li>
1415 <li data-name="LuCI.ui.FileUpload#triggerValidation"><a href="LuCI.ui.FileUpload.html#triggerValidation">triggerValidation</a></li>
1418 <ul class="events itemMembers">
1423 <li class="item" data-name="LuCI.ui.Hiddenfield">
1424 <span class="title">
1425 <a href="LuCI.ui.Hiddenfield.html">LuCI.ui.Hiddenfield</a>
1428 <ul class="members itemMembers">
1431 <ul class="typedefs itemMembers">
1434 <ul class="typedefs itemMembers">
1437 <ul class="methods itemMembers">
1439 <span class="subtitle">Methods</span>
1441 <li data-name="LuCI.ui.Hiddenfield#getValue"><a href="LuCI.ui.Hiddenfield.html#getValue">getValue</a></li>
1443 <li data-name="LuCI.ui.Hiddenfield#isValid"><a href="LuCI.ui.Hiddenfield.html#isValid">isValid</a></li>
1445 <li data-name="LuCI.ui.Hiddenfield#registerEvents"><a href="LuCI.ui.Hiddenfield.html#registerEvents">registerEvents</a></li>
1447 <li data-name="LuCI.ui.Hiddenfield#render"><a href="LuCI.ui.Hiddenfield.html#render">render</a></li>
1449 <li data-name="LuCI.ui.Hiddenfield#setChangeEvents"><a href="LuCI.ui.Hiddenfield.html#setChangeEvents">setChangeEvents</a></li>
1451 <li data-name="LuCI.ui.Hiddenfield#setUpdateEvents"><a href="LuCI.ui.Hiddenfield.html#setUpdateEvents">setUpdateEvents</a></li>
1453 <li data-name="LuCI.ui.Hiddenfield#setValue"><a href="LuCI.ui.Hiddenfield.html#setValue">setValue</a></li>
1455 <li data-name="LuCI.ui.Hiddenfield#triggerValidation"><a href="LuCI.ui.Hiddenfield.html#triggerValidation">triggerValidation</a></li>
1458 <ul class="events itemMembers">
1463 <li class="item" data-name="LuCI.ui.Select">
1464 <span class="title">
1465 <a href="LuCI.ui.Select.html">LuCI.ui.Select</a>
1468 <ul class="members itemMembers">
1471 <ul class="typedefs itemMembers">
1473 <span class="subtitle">Typedefs</span>
1475 <li data-name="LuCI.ui.Select.InitOptions"><a href="LuCI.ui.Select.html#.InitOptions">InitOptions</a></li>
1478 <ul class="typedefs itemMembers">
1481 <ul class="methods itemMembers">
1483 <span class="subtitle">Methods</span>
1485 <li data-name="LuCI.ui.Select#getValue"><a href="LuCI.ui.Select.html#getValue">getValue</a></li>
1487 <li data-name="LuCI.ui.Select#isValid"><a href="LuCI.ui.Select.html#isValid">isValid</a></li>
1489 <li data-name="LuCI.ui.Select#registerEvents"><a href="LuCI.ui.Select.html#registerEvents">registerEvents</a></li>
1491 <li data-name="LuCI.ui.Select#render"><a href="LuCI.ui.Select.html#render">render</a></li>
1493 <li data-name="LuCI.ui.Select#setChangeEvents"><a href="LuCI.ui.Select.html#setChangeEvents">setChangeEvents</a></li>
1495 <li data-name="LuCI.ui.Select#setUpdateEvents"><a href="LuCI.ui.Select.html#setUpdateEvents">setUpdateEvents</a></li>
1497 <li data-name="LuCI.ui.Select#setValue"><a href="LuCI.ui.Select.html#setValue">setValue</a></li>
1499 <li data-name="LuCI.ui.Select#triggerValidation"><a href="LuCI.ui.Select.html#triggerValidation">triggerValidation</a></li>
1502 <ul class="events itemMembers">
1507 <li class="item" data-name="LuCI.ui.tabs">
1508 <span class="title">
1509 <a href="LuCI.ui.tabs.html">LuCI.ui.tabs</a>
1512 <ul class="members itemMembers">
1515 <ul class="typedefs itemMembers">
1518 <ul class="typedefs itemMembers">
1521 <ul class="methods itemMembers">
1523 <span class="subtitle">Methods</span>
1525 <li data-name="LuCI.ui.tabs#initTabGroup"><a href="LuCI.ui.tabs.html#initTabGroup">initTabGroup</a></li>
1527 <li data-name="LuCI.ui.tabs#isEmptyPane"><a href="LuCI.ui.tabs.html#isEmptyPane">isEmptyPane</a></li>
1530 <ul class="events itemMembers">
1535 <li class="item" data-name="LuCI.ui.Textarea">
1536 <span class="title">
1537 <a href="LuCI.ui.Textarea.html">LuCI.ui.Textarea</a>
1540 <ul class="members itemMembers">
1543 <ul class="typedefs itemMembers">
1545 <span class="subtitle">Typedefs</span>
1547 <li data-name="LuCI.ui.Textarea.InitOptions"><a href="LuCI.ui.Textarea.html#.InitOptions">InitOptions</a></li>
1550 <ul class="typedefs itemMembers">
1553 <ul class="methods itemMembers">
1555 <span class="subtitle">Methods</span>
1557 <li data-name="LuCI.ui.Textarea#getValue"><a href="LuCI.ui.Textarea.html#getValue">getValue</a></li>
1559 <li data-name="LuCI.ui.Textarea#isValid"><a href="LuCI.ui.Textarea.html#isValid">isValid</a></li>
1561 <li data-name="LuCI.ui.Textarea#registerEvents"><a href="LuCI.ui.Textarea.html#registerEvents">registerEvents</a></li>
1563 <li data-name="LuCI.ui.Textarea#render"><a href="LuCI.ui.Textarea.html#render">render</a></li>
1565 <li data-name="LuCI.ui.Textarea#setChangeEvents"><a href="LuCI.ui.Textarea.html#setChangeEvents">setChangeEvents</a></li>
1567 <li data-name="LuCI.ui.Textarea#setUpdateEvents"><a href="LuCI.ui.Textarea.html#setUpdateEvents">setUpdateEvents</a></li>
1569 <li data-name="LuCI.ui.Textarea#setValue"><a href="LuCI.ui.Textarea.html#setValue">setValue</a></li>
1571 <li data-name="LuCI.ui.Textarea#triggerValidation"><a href="LuCI.ui.Textarea.html#triggerValidation">triggerValidation</a></li>
1574 <ul class="events itemMembers">
1579 <li class="item" data-name="LuCI.ui.Textfield">
1580 <span class="title">
1581 <a href="LuCI.ui.Textfield.html">LuCI.ui.Textfield</a>
1584 <ul class="members itemMembers">
1587 <ul class="typedefs itemMembers">
1589 <span class="subtitle">Typedefs</span>
1591 <li data-name="LuCI.ui.Textfield.InitOptions"><a href="LuCI.ui.Textfield.html#.InitOptions">InitOptions</a></li>
1594 <ul class="typedefs itemMembers">
1597 <ul class="methods itemMembers">
1599 <span class="subtitle">Methods</span>
1601 <li data-name="LuCI.ui.Textfield#getValue"><a href="LuCI.ui.Textfield.html#getValue">getValue</a></li>
1603 <li data-name="LuCI.ui.Textfield#isValid"><a href="LuCI.ui.Textfield.html#isValid">isValid</a></li>
1605 <li data-name="LuCI.ui.Textfield#registerEvents"><a href="LuCI.ui.Textfield.html#registerEvents">registerEvents</a></li>
1607 <li data-name="LuCI.ui.Textfield#render"><a href="LuCI.ui.Textfield.html#render">render</a></li>
1609 <li data-name="LuCI.ui.Textfield#setChangeEvents"><a href="LuCI.ui.Textfield.html#setChangeEvents">setChangeEvents</a></li>
1611 <li data-name="LuCI.ui.Textfield#setUpdateEvents"><a href="LuCI.ui.Textfield.html#setUpdateEvents">setUpdateEvents</a></li>
1613 <li data-name="LuCI.ui.Textfield#setValue"><a href="LuCI.ui.Textfield.html#setValue">setValue</a></li>
1615 <li data-name="LuCI.ui.Textfield#triggerValidation"><a href="LuCI.ui.Textfield.html#triggerValidation">triggerValidation</a></li>
1618 <ul class="events itemMembers">
1623 <li class="item" data-name="LuCI.view">
1624 <span class="title">
1625 <a href="LuCI.view.html">LuCI.view</a>
1628 <ul class="members itemMembers">
1631 <ul class="typedefs itemMembers">
1634 <ul class="typedefs itemMembers">
1637 <ul class="methods itemMembers">
1639 <span class="subtitle">Methods</span>
1641 <li data-name="LuCI.view#addFooter"><a href="LuCI.view.html#addFooter">addFooter</a></li>
1643 <li data-name="LuCI.view#handleReset"><a href="LuCI.view.html#handleReset">handleReset</a></li>
1645 <li data-name="LuCI.view#handleSave"><a href="LuCI.view.html#handleSave">handleSave</a></li>
1647 <li data-name="LuCI.view#handleSaveApply"><a href="LuCI.view.html#handleSaveApply">handleSaveApply</a></li>
1649 <li data-name="LuCI.view#load"><a href="LuCI.view.html#load">load</a></li>
1651 <li data-name="LuCI.view#render"><a href="LuCI.view.html#render">render</a></li>
1654 <ul class="events itemMembers">
1659 <li class="item" data-name="LuCI.xhr">
1660 <span class="title">
1661 <a href="LuCI.xhr.html">LuCI.xhr</a>
1664 <ul class="members itemMembers">
1667 <ul class="typedefs itemMembers">
1670 <ul class="typedefs itemMembers">
1673 <ul class="methods itemMembers">
1675 <span class="subtitle">Methods</span>
1677 <li data-name="LuCI.xhr#abort"><a href="LuCI.xhr.html#abort">abort</a></li>
1679 <li data-name="LuCI.xhr#busy"><a href="LuCI.xhr.html#busy">busy</a></li>
1681 <li data-name="LuCI.xhr#cancel"><a href="LuCI.xhr.html#cancel">cancel</a></li>
1683 <li data-name="LuCI.xhr#get"><a href="LuCI.xhr.html#get">get</a></li>
1685 <li data-name="LuCI.xhr#post"><a href="LuCI.xhr.html#post">post</a></li>
1687 <li data-name="LuCI.xhr#send_form"><a href="LuCI.xhr.html#send_form">send_form</a></li>
1690 <ul class="events itemMembers">
1698 <h1 class="page-title" data-filename="luci.js.html">Source: luci.js</h1>
1705 <pre id="source-code" class="prettyprint source "><code>/**
1709 * This is the LuCI base class. It is automatically instantiated and
1710 * accessible using the global `L` variable.
1712 * @param {Object} env
1713 * The environment settings to use for the LuCI runtime.
1716 (function(window, document, undefined) {
1719 /* Object.assign polyfill for IE */
1720 if (typeof Object.assign !== 'function') {
1721 Object.defineProperty(Object, 'assign', {
1722 value: function assign(target, varArgs) {
1724 throw new TypeError('Cannot convert undefined or null to object');
1726 var to = Object(target);
1728 for (var index = 1; index < arguments.length; index++)
1729 if (arguments[index] != null)
1730 for (var nextKey in arguments[index])
1731 if (Object.prototype.hasOwnProperty.call(arguments[index], nextKey))
1732 to[nextKey] = arguments[index][nextKey];
1741 /* Promise.finally polyfill */
1742 if (typeof Promise.prototype.finally !== 'function') {
1743 Promise.prototype.finally = function(fn) {
1744 var onFinally = function(cb) {
1745 return Promise.resolve(fn.call(this)).then(cb);
1749 function(result) { return onFinally.call(this, function() { return result }) },
1750 function(reason) { return onFinally.call(this, function() { return Promise.reject(reason) }) }
1756 * Class declaration and inheritance helper
1759 var toCamelCase = function(s) {
1760 return s.replace(/(?:^|[\. -])(.)/g, function(m0, m1) { return m1.toUpperCase() });
1769 * `LuCI.baseclass` is the abstract base class all LuCI classes inherit from.
1771 * It provides simple means to create subclasses of given classes and
1772 * implements prototypal inheritance.
1774 var superContext = {}, classIndex = 0, Class = Object.assign(function() {}, {
1776 * Extends this base class with the properties described in
1777 * `properties` and returns a new subclassed Class instance
1779 * @memberof LuCI.baseclass
1781 * @param {Object<string, *>} properties
1782 * An object describing the properties to add to the new
1785 * @returns {LuCI.baseclass}
1786 * Returns a new LuCI.baseclass sublassed from this class, extended
1787 * by the given properties and with its prototype set to this base
1788 * class to enable inheritance. The resulting value represents a
1789 * class constructor and can be instantiated with `new`.
1791 extend: function(properties) {
1793 __id__: { value: classIndex },
1794 __base__: { value: this.prototype },
1795 __name__: { value: properties.__name__ || 'anonymous' + classIndex++ }
1798 var ClassConstructor = function() {
1799 if (!(this instanceof ClassConstructor))
1800 throw new TypeError('Constructor must not be called without "new"');
1802 if (Object.getPrototypeOf(this).hasOwnProperty('__init__')) {
1803 if (typeof(this.__init__) != 'function')
1804 throw new TypeError('Class __init__ member is not a function');
1806 this.__init__.apply(this, arguments)
1809 this.super('__init__', arguments);
1813 for (var key in properties)
1814 if (!props[key] && properties.hasOwnProperty(key))
1815 props[key] = { value: properties[key], writable: true };
1817 ClassConstructor.prototype = Object.create(this.prototype, props);
1818 ClassConstructor.prototype.constructor = ClassConstructor;
1819 Object.assign(ClassConstructor, this);
1820 ClassConstructor.displayName = toCamelCase(props.__name__.value + 'Class');
1822 return ClassConstructor;
1826 * Extends this base class with the properties described in
1827 * `properties`, instantiates the resulting subclass using
1828 * the additional optional arguments passed to this function
1829 * and returns the resulting subclassed Class instance.
1831 * This function serves as a convenience shortcut for
1832 * {@link LuCI.baseclass.extend Class.extend()} and subsequent
1835 * @memberof LuCI.baseclass
1837 * @param {Object<string, *>} properties
1838 * An object describing the properties to add to the new
1841 * @param {...*} [new_args]
1842 * Specifies arguments to be passed to the subclass constructor
1843 * as-is in order to instantiate the new subclass.
1845 * @returns {LuCI.baseclass}
1846 * Returns a new LuCI.baseclass instance extended by the given
1847 * properties with its prototype set to this base class to
1848 * enable inheritance.
1850 singleton: function(properties /*, ... */) {
1851 return Class.extend(properties)
1852 .instantiate(Class.prototype.varargs(arguments, 1));
1856 * Calls the class constructor using `new` with the given argument
1857 * array being passed as variadic parameters to the constructor.
1859 * @memberof LuCI.baseclass
1861 * @param {Array<*>} params
1862 * An array of arbitrary values which will be passed as arguments
1863 * to the constructor function.
1865 * @param {...*} [new_args]
1866 * Specifies arguments to be passed to the subclass constructor
1867 * as-is in order to instantiate the new subclass.
1869 * @returns {LuCI.baseclass}
1870 * Returns a new LuCI.baseclass instance extended by the given
1871 * properties with its prototype set to this base class to
1872 * enable inheritance.
1874 instantiate: function(args) {
1875 return new (Function.prototype.bind.apply(this,
1876 Class.prototype.varargs(args, 0, null)))();
1880 call: function(self, method) {
1881 if (typeof(this.prototype[method]) != 'function')
1882 throw new ReferenceError(method + ' is not defined in class');
1884 return this.prototype[method].apply(self, self.varargs(arguments, 1));
1888 * Checks whether the given class value is a subclass of this class.
1890 * @memberof LuCI.baseclass
1892 * @param {LuCI.baseclass} classValue
1893 * The class object to test.
1895 * @returns {boolean}
1896 * Returns `true` when the given `classValue` is a subclass of this
1897 * class or `false` if the given value is not a valid class or not
1898 * a subclass of this class'.
1900 isSubclass: function(classValue) {
1901 return (classValue != null &&
1902 typeof(classValue) == 'function' &&
1903 classValue.prototype instanceof this);
1908 * Extract all values from the given argument array beginning from
1909 * `offset` and prepend any further given optional parameters to
1910 * the beginning of the resulting array copy.
1912 * @memberof LuCI.baseclass
1915 * @param {Array<*>} args
1916 * The array to extract the values from.
1918 * @param {number} offset
1919 * The offset from which to extract the values. An offset of `0`
1920 * would copy all values till the end.
1922 * @param {...*} [extra_args]
1923 * Extra arguments to add to prepend to the resultung array.
1925 * @returns {Array<*>}
1926 * Returns a new array consisting of the optional extra arguments
1927 * and the values extracted from the `args` array beginning with
1930 varargs: function(args, offset /*, ... */) {
1931 return Array.prototype.slice.call(arguments, 2)
1932 .concat(Array.prototype.slice.call(args, offset));
1936 * Walks up the parent class chain and looks for a class member
1937 * called `key` in any of the parent classes this class inherits
1938 * from. Returns the member value of the superclass or calls the
1939 * member as function and returns its return value when the
1940 * optional `callArgs` array is given.
1942 * This function has two signatures and is sensitive to the
1943 * amount of arguments passed to it:
1944 * - `super('key')` -
1945 * Returns the value of `key` when found within one of the
1947 * - `super('key', ['arg1', 'arg2'])` -
1948 * Calls the `key()` method with parameters `arg1` and `arg2`
1949 * when found within one of the parent classes.
1951 * @memberof LuCI.baseclass
1954 * @param {string} key
1955 * The name of the superclass member to retrieve.
1957 * @param {Array<*>} [callArgs]
1958 * An optional array of function call parameters to use. When
1959 * this parameter is specified, the found member value is called
1960 * as function using the values of this array as arguments.
1962 * @throws {ReferenceError}
1963 * Throws a `ReferenceError` when `callArgs` are specified and
1964 * the found member named by `key` is not a function value.
1967 * Returns the value of the found member or the return value of
1968 * the call to the found method. Returns `null` when no member
1969 * was found in the parent class chain or when the call to the
1970 * superclass method returned `null`.
1972 super: function(key, callArgs) {
1976 var slotIdx = this.__id__ + '.' + key,
1977 symStack = superContext[slotIdx],
1980 for (protoCtx = Object.getPrototypeOf(symStack ? symStack[0] : Object.getPrototypeOf(this));
1981 protoCtx != null && !protoCtx.hasOwnProperty(key);
1982 protoCtx = Object.getPrototypeOf(protoCtx)) {}
1984 if (protoCtx == null)
1987 var res = protoCtx[key];
1989 if (arguments.length > 1) {
1990 if (typeof(res) != 'function')
1991 throw new ReferenceError(key + ' is not a function in base class');
1993 if (typeof(callArgs) != 'object')
1994 callArgs = this.varargs(arguments, 1);
1997 symStack.unshift(protoCtx);
1999 superContext[slotIdx] = [ protoCtx ];
2001 res = res.apply(this, callArgs);
2003 if (symStack && symStack.length > 1)
2004 symStack.shift(protoCtx);
2006 delete superContext[slotIdx];
2013 * Returns a string representation of this class.
2016 * Returns a string representation of this class containing the
2017 * constructor functions `displayName` and describing the class
2018 * members and their respective types.
2020 toString: function() {
2021 var s = '[' + this.constructor.displayName + ']', f = true;
2022 for (var k in this) {
2023 if (this.hasOwnProperty(k)) {
2024 s += (f ? ' {\n' : '') + ' ' + k + ': ' + typeof(this[k]) + '\n';
2028 return s + (f ? '' : '}');
2040 * The `Headers` class is an internal utility class exposed in HTTP
2041 * response objects using the `response.headers` property.
2043 var Headers = Class.extend(/** @lends LuCI.headers.prototype */ {
2044 __name__: 'LuCI.headers',
2045 __init__: function(xhr) {
2046 var hdrs = this.headers = {};
2047 xhr.getAllResponseHeaders().split(/\r\n/).forEach(function(line) {
2048 var m = /^([^:]+):(.*)$/.exec(line);
2050 hdrs[m[1].trim().toLowerCase()] = m[2].trim();
2055 * Checks whether the given header name is present.
2056 * Note: Header-Names are case-insensitive.
2059 * @memberof LuCI.headers
2060 * @param {string} name
2061 * The header name to check
2063 * @returns {boolean}
2064 * Returns `true` if the header name is present, `false` otherwise
2066 has: function(name) {
2067 return this.headers.hasOwnProperty(String(name).toLowerCase());
2071 * Returns the value of the given header name.
2072 * Note: Header-Names are case-insensitive.
2075 * @memberof LuCI.headers
2076 * @param {string} name
2077 * The header name to read
2079 * @returns {string|null}
2080 * The value of the given header name or `null` if the header isn't present.
2082 get: function(name) {
2083 var key = String(name).toLowerCase();
2084 return this.headers.hasOwnProperty(key) ? this.headers[key] : null;
2094 * The `Response` class is an internal utility class representing HTTP responses.
2096 var Response = Class.extend({
2097 __name__: 'LuCI.response',
2098 __init__: function(xhr, url, duration, headers, content) {
2100 * Describes whether the response is successful (status codes `200..299`) or not
2102 * @memberof LuCI.response
2106 this.ok = (xhr.status >= 200 && xhr.status <= 299);
2109 * The numeric HTTP status code of the response
2111 * @memberof LuCI.response
2115 this.status = xhr.status;
2118 * The HTTP status description message of the response
2120 * @memberof LuCI.response
2124 this.statusText = xhr.statusText;
2127 * The HTTP headers of the response
2129 * @memberof LuCI.response
2131 * @type {LuCI.headers}
2133 this.headers = (headers != null) ? headers : new Headers(xhr);
2136 * The total duration of the HTTP request in milliseconds
2138 * @memberof LuCI.response
2142 this.duration = duration;
2145 * The final URL of the request, i.e. after following redirects.
2147 * @memberof LuCI.response
2156 if (content instanceof Blob) {
2157 this.responseBlob = content;
2158 this.responseJSON = null;
2159 this.responseText = null;
2161 else if (content != null && typeof(content) == 'object') {
2162 this.responseBlob = null;
2163 this.responseJSON = content;
2164 this.responseText = null;
2166 else if (content != null) {
2167 this.responseBlob = null;
2168 this.responseJSON = null;
2169 this.responseText = String(content);
2172 this.responseJSON = null;
2174 if (xhr.responseType == 'blob') {
2175 this.responseBlob = xhr.response;
2176 this.responseText = null;
2179 this.responseBlob = null;
2180 this.responseText = xhr.responseText;
2186 * Clones the given response object, optionally overriding the content
2187 * of the cloned instance.
2190 * @memberof LuCI.response
2191 * @param {*} [content]
2192 * Override the content of the cloned response. Object values will be
2193 * treated as JSON response data, all other types will be converted
2194 * using `String()` and treated as response text.
2196 * @returns {LuCI.response}
2197 * The cloned `Response` instance.
2199 clone: function(content) {
2200 var copy = new Response(this.xhr, this.url, this.duration, this.headers, content);
2203 copy.status = this.status;
2204 copy.statusText = this.statusText;
2210 * Access the response content as JSON data.
2213 * @memberof LuCI.response
2214 * @throws {SyntaxError}
2215 * Throws `SyntaxError` if the content isn't valid JSON.
2218 * The parsed JSON data.
2221 if (this.responseJSON == null)
2222 this.responseJSON = JSON.parse(this.responseText);
2224 return this.responseJSON;
2228 * Access the response content as string.
2231 * @memberof LuCI.response
2233 * The response content.
2236 if (this.responseText == null && this.responseJSON != null)
2237 this.responseText = JSON.stringify(this.responseJSON);
2239 return this.responseText;
2243 * Access the response content as blob.
2246 * @memberof LuCI.response
2248 * The response content as blob.
2251 return this.responseBlob;
2256 var requestQueue = [];
2258 function isQueueableRequest(opt) {
2262 if (opt.method != 'POST' || typeof(opt.content) != 'object')
2265 if (opt.nobatch === true)
2268 var rpcBaseURL = Request.expandURL(classes.rpc.getBaseURL());
2270 return (rpcBaseURL != null && opt.url.indexOf(rpcBaseURL) == 0);
2273 function flushRequestQueue() {
2274 if (!requestQueue.length)
2277 var reqopt = Object.assign({}, requestQueue[0][0], { content: [], nobatch: true }),
2280 for (var i = 0; i < requestQueue.length; i++) {
2281 batch[i] = requestQueue[i];
2282 reqopt.content[i] = batch[i][0].content;
2285 requestQueue.length = 0;
2287 Request.request(rpcBaseURL, reqopt).then(function(reply) {
2288 var json = null, req = null;
2290 try { json = reply.json() }
2293 while ((req = batch.shift()) != null)
2294 if (Array.isArray(json) && json.length)
2295 req[2].call(reqopt, reply.clone(json.shift()));
2297 req[1].call(reqopt, new Error('No related RPC reply'));
2298 }).catch(function(error) {
2301 while ((req = batch.shift()) != null)
2302 req[1].call(reqopt, error);
2312 * The `Request` class allows initiating HTTP requests and provides utilities
2313 * for dealing with responses.
2315 var Request = Class.singleton(/** @lends LuCI.request.prototype */ {
2316 __name__: 'LuCI.request',
2321 * Turn the given relative URL into an absolute URL if necessary.
2324 * @memberof LuCI.request
2325 * @param {string} url
2326 * The URL to convert.
2329 * The absolute URL derived from the given one, or the original URL
2330 * if it already was absolute.
2332 expandURL: function(url) {
2333 if (!/^(?:[^/]+:)?\/\//.test(url))
2334 url = location.protocol + '//' + location.host + url;
2340 * @typedef {Object} RequestOptions
2341 * @memberof LuCI.request
2343 * @property {string} [method=GET]
2344 * The HTTP method to use, e.g. `GET` or `POST`.
2346 * @property {Object<string, Object|string>} [query]
2347 * Query string data to append to the URL. Non-string values of the
2348 * given object will be converted to JSON.
2350 * @property {boolean} [cache=false]
2351 * Specifies whether the HTTP response may be retrieved from cache.
2353 * @property {string} [username]
2354 * Provides a username for HTTP basic authentication.
2356 * @property {string} [password]
2357 * Provides a password for HTTP basic authentication.
2359 * @property {number} [timeout]
2360 * Specifies the request timeout in seconds.
2362 * @property {boolean} [credentials=false]
2363 * Whether to include credentials such as cookies in the request.
2365 * @property {string} [responseType=text]
2366 * Overrides the request response type. Valid values or `text` to
2367 * interpret the response as UTF-8 string or `blob` to handle the
2368 * response as binary `Blob` data.
2370 * @property {*} [content]
2371 * Specifies the HTTP message body to send along with the request.
2372 * If the value is a function, it is invoked and the return value
2373 * used as content, if it is a FormData instance, it is used as-is,
2374 * if it is an object, it will be converted to JSON, in all other
2375 * cases it is converted to a string.
2377 * @property {Object<string, string>} [header]
2378 * Specifies HTTP headers to set for the request.
2380 * @property {function} [progress]
2381 * An optional request callback function which receives ProgressEvent
2382 * instances as sole argument during the HTTP request transfer.
2386 * Initiate an HTTP request to the given target.
2389 * @memberof LuCI.request
2390 * @param {string} target
2391 * The URL to request.
2393 * @param {LuCI.request.RequestOptions} [options]
2394 * Additional options to configure the request.
2396 * @returns {Promise<LuCI.response>}
2397 * The resulting HTTP response.
2399 request: function(target, options) {
2400 var state = { xhr: new XMLHttpRequest(), url: this.expandURL(target), start: Date.now() },
2401 opt = Object.assign({}, options, state),
2404 callback = this.handleReadyStateChange;
2406 return new Promise(function(resolveFn, rejectFn) {
2407 opt.xhr.onreadystatechange = callback.bind(opt, resolveFn, rejectFn);
2408 opt.method = String(opt.method || 'GET').toUpperCase();
2410 if ('query' in opt) {
2411 var q = (opt.query != null) ? Object.keys(opt.query).map(function(k) {
2412 if (opt.query[k] != null) {
2413 var v = (typeof(opt.query[k]) == 'object')
2414 ? JSON.stringify(opt.query[k])
2415 : String(opt.query[k]);
2417 return '%s=%s'.format(encodeURIComponent(k), encodeURIComponent(v));
2420 return encodeURIComponent(k);
2422 }).join('&') : '';
2425 switch (opt.method) {
2429 opt.url += ((/\?/).test(opt.url) ? '&' : '?') + q;
2433 if (content == null) {
2435 contenttype = 'application/x-www-form-urlencoded';
2442 opt.url += ((/\?/).test(opt.url) ? '&' : '?') + (new Date()).getTime();
2444 if (isQueueableRequest(opt)) {
2445 requestQueue.push([opt, rejectFn, resolveFn]);
2446 requestAnimationFrame(flushRequestQueue);
2450 if ('username' in opt && 'password' in opt)
2451 opt.xhr.open(opt.method, opt.url, true, opt.username, opt.password);
2453 opt.xhr.open(opt.method, opt.url, true);
2455 opt.xhr.responseType = opt.responseType || 'text';
2457 if ('overrideMimeType' in opt.xhr)
2458 opt.xhr.overrideMimeType('application/octet-stream');
2460 if ('timeout' in opt)
2461 opt.xhr.timeout = +opt.timeout;
2463 if ('credentials' in opt)
2464 opt.xhr.withCredentials = !!opt.credentials;
2466 if (opt.content != null) {
2467 switch (typeof(opt.content)) {
2469 content = opt.content(xhr);
2473 if (!(opt.content instanceof FormData)) {
2474 content = JSON.stringify(opt.content);
2475 contenttype = 'application/json';
2478 content = opt.content;
2483 content = String(opt.content);
2487 if ('headers' in opt)
2488 for (var header in opt.headers)
2489 if (opt.headers.hasOwnProperty(header)) {
2490 if (header.toLowerCase() != 'content-type')
2491 opt.xhr.setRequestHeader(header, opt.headers[header]);
2493 contenttype = opt.headers[header];
2496 if ('progress' in opt && 'upload' in opt.xhr)
2497 opt.xhr.upload.addEventListener('progress', opt.progress);
2499 if (contenttype != null)
2500 opt.xhr.setRequestHeader('Content-Type', contenttype);
2503 opt.xhr.send(content);
2506 rejectFn.call(opt, e);
2511 handleReadyStateChange: function(resolveFn, rejectFn, ev) {
2513 duration = Date.now() - this.start;
2515 if (xhr.readyState !== 4)
2518 if (xhr.status === 0 && xhr.statusText === '') {
2519 if (duration >= this.timeout)
2520 rejectFn.call(this, new Error('XHR request timed out'));
2522 rejectFn.call(this, new Error('XHR request aborted by browser'));
2525 var response = new Response(
2526 xhr, xhr.responseURL || this.url, duration);
2528 Promise.all(Request.interceptors.map(function(fn) { return fn(response) }))
2529 .then(resolveFn.bind(this, response))
2530 .catch(rejectFn.bind(this));
2535 * Initiate an HTTP GET request to the given target.
2538 * @memberof LuCI.request
2539 * @param {string} target
2540 * The URL to request.
2542 * @param {LuCI.request.RequestOptions} [options]
2543 * Additional options to configure the request.
2545 * @returns {Promise<LuCI.response>}
2546 * The resulting HTTP response.
2548 get: function(url, options) {
2549 return this.request(url, Object.assign({ method: 'GET' }, options));
2553 * Initiate an HTTP POST request to the given target.
2556 * @memberof LuCI.request
2557 * @param {string} target
2558 * The URL to request.
2561 * The request data to send, see {@link LuCI.request.RequestOptions} for details.
2563 * @param {LuCI.request.RequestOptions} [options]
2564 * Additional options to configure the request.
2566 * @returns {Promise<LuCI.response>}
2567 * The resulting HTTP response.
2569 post: function(url, data, options) {
2570 return this.request(url, Object.assign({ method: 'POST', content: data }, options));
2574 * Interceptor functions are invoked whenever an HTTP reply is received, in the order
2575 * these functions have been registered.
2576 * @callback LuCI.request.interceptorFn
2577 * @param {LuCI.response} res
2578 * The HTTP response object
2582 * Register an HTTP response interceptor function. Interceptor
2583 * functions are useful to perform default actions on incoming HTTP
2584 * responses, such as checking for expired authentication or for
2585 * implementing request retries before returning a failure.
2588 * @memberof LuCI.request
2589 * @param {LuCI.request.interceptorFn} interceptorFn
2590 * The interceptor function to register.
2592 * @returns {LuCI.request.interceptorFn}
2593 * The registered function.
2595 addInterceptor: function(interceptorFn) {
2596 if (typeof(interceptorFn) == 'function')
2597 this.interceptors.push(interceptorFn);
2598 return interceptorFn;
2602 * Remove an HTTP response interceptor function. The passed function
2603 * value must be the very same value that was used to register the
2607 * @memberof LuCI.request
2608 * @param {LuCI.request.interceptorFn} interceptorFn
2609 * The interceptor function to remove.
2611 * @returns {boolean}
2612 * Returns `true` if any function has been removed, else `false`.
2614 removeInterceptor: function(interceptorFn) {
2615 var oldlen = this.interceptors.length, i = oldlen;
2617 if (this.interceptors[i] === interceptorFn)
2618 this.interceptors.splice(i, 1);
2619 return (this.interceptors.length < oldlen);
2624 * @memberof LuCI.request
2628 * The `Request.poll` class provides some convience wrappers around
2629 * {@link LuCI.poll} mainly to simplify registering repeating HTTP
2630 * request calls as polling functions.
2634 * The callback function is invoked whenever an HTTP reply to a
2635 * polled request is received or when the polled request timed
2638 * @callback LuCI.request.poll~callbackFn
2639 * @param {LuCI.response} res
2640 * The HTTP response object.
2643 * The response JSON if the response could be parsed as such,
2646 * @param {number} duration
2647 * The total duration of the request in milliseconds.
2651 * Register a repeating HTTP request with an optional callback
2652 * to invoke whenever a response for the request is received.
2655 * @memberof LuCI.request.poll
2656 * @param {number} interval
2657 * The poll interval in seconds.
2659 * @param {string} url
2660 * The URL to request on each poll.
2662 * @param {LuCI.request.RequestOptions} [options]
2663 * Additional options to configure the request.
2665 * @param {LuCI.request.poll~callbackFn} [callback]
2666 * {@link LuCI.request.poll~callbackFn Callback} function to
2667 * invoke for each HTTP reply.
2669 * @throws {TypeError}
2670 * Throws `TypeError` when an invalid interval was passed.
2672 * @returns {function}
2673 * Returns the internally created poll function.
2675 add: function(interval, url, options, callback) {
2676 if (isNaN(interval) || interval <= 0)
2677 throw new TypeError('Invalid poll interval');
2679 var ival = interval >>> 0,
2680 opts = Object.assign({}, options, { timeout: ival * 1000 - 5 });
2682 var fn = function() {
2683 return Request.request(url, options).then(function(res) {
2688 callback(res, res.json(), res.duration);
2691 callback(res, null, res.duration);
2696 return (Poll.add(fn, ival) ? fn : null);
2700 * Remove a polling request that has been previously added using `add()`.
2701 * This function is essentially a wrapper around
2702 * {@link LuCI.poll.remove LuCI.poll.remove()}.
2705 * @memberof LuCI.request.poll
2706 * @param {function} entry
2707 * The poll function returned by {@link LuCI.request.poll#add add()}.
2709 * @returns {boolean}
2710 * Returns `true` if any function has been removed, else `false`.
2712 remove: function(entry) { return Poll.remove(entry) },
2715 * Alias for {@link LuCI.poll.start LuCI.poll.start()}.
2718 * @memberof LuCI.request.poll
2720 start: function() { return Poll.start() },
2723 * Alias for {@link LuCI.poll.stop LuCI.poll.stop()}.
2726 * @memberof LuCI.request.poll
2728 stop: function() { return Poll.stop() },
2731 * Alias for {@link LuCI.poll.active LuCI.poll.active()}.
2734 * @memberof LuCI.request.poll
2736 active: function() { return Poll.active() }
2746 * The `Poll` class allows registering and unregistering poll actions,
2747 * as well as starting, stopping and querying the state of the polling
2750 var Poll = Class.singleton(/** @lends LuCI.poll.prototype */ {
2751 __name__: 'LuCI.poll',
2756 * Add a new operation to the polling loop. If the polling loop is not
2757 * already started at this point, it will be implicitely started.
2760 * @memberof LuCI.poll
2761 * @param {function} fn
2762 * The function to invoke on each poll interval.
2764 * @param {number} interval
2765 * The poll interval in seconds.
2767 * @throws {TypeError}
2768 * Throws `TypeError` when an invalid interval was passed.
2770 * @returns {boolean}
2771 * Returns `true` if the function has been added or `false` if it
2772 * already is registered.
2774 add: function(fn, interval) {
2775 if (interval == null || interval <= 0)
2776 interval = window.L ? window.L.env.pollinterval : null;
2778 if (isNaN(interval) || typeof(fn) != 'function')
2779 throw new TypeError('Invalid argument to LuCI.poll.add()');
2781 for (var i = 0; i < this.queue.length; i++)
2782 if (this.queue[i].fn === fn)
2793 if (this.tick != null && !this.active())
2800 * Remove an operation from the polling loop. If no further operatons
2801 * are registered, the polling loop is implicitely stopped.
2804 * @memberof LuCI.poll
2805 * @param {function} fn
2806 * The function to remove.
2808 * @throws {TypeError}
2809 * Throws `TypeError` when the given argument isn't a function.
2811 * @returns {boolean}
2812 * Returns `true` if the function has been removed or `false` if it
2815 remove: function(fn) {
2816 if (typeof(fn) != 'function')
2817 throw new TypeError('Invalid argument to LuCI.poll.remove()');
2819 var len = this.queue.length;
2821 for (var i = len; i > 0; i--)
2822 if (this.queue[i-1].fn === fn)
2823 this.queue.splice(i-1, 1);
2825 if (!this.queue.length && this.stop())
2828 return (this.queue.length != len);
2832 * (Re)start the polling loop. Dispatches a custom `poll-start` event
2833 * to the `document` object upon successful start.
2836 * @memberof LuCI.poll
2837 * @returns {boolean}
2838 * Returns `true` if polling has been started (or if no functions
2839 * where registered) or `false` when the polling loop already runs.
2847 if (this.queue.length) {
2848 this.timer = window.setInterval(this.step, 1000);
2850 document.dispatchEvent(new CustomEvent('poll-start'));
2857 * Stop the polling loop. Dispatches a custom `poll-stop` event
2858 * to the `document` object upon successful stop.
2861 * @memberof LuCI.poll
2862 * @returns {boolean}
2863 * Returns `true` if polling has been stopped or `false` if it din't
2864 * run to begin with.
2870 document.dispatchEvent(new CustomEvent('poll-stop'));
2871 window.clearInterval(this.timer);
2879 for (var i = 0, e = null; (e = Poll.queue[i]) != null; i++) {
2880 if ((Poll.tick % e.i) != 0)
2888 Promise.resolve(e.fn()).finally((function() { this.r = true }).bind(e));
2891 Poll.tick = (Poll.tick + 1) % Math.pow(2, 32);
2895 * Test whether the polling loop is running.
2898 * @memberof LuCI.poll
2899 * @returns {boolean} - Returns `true` if polling is active, else `false`.
2901 active: function() {
2902 return (this.timer != null);
2912 * The `dom` class provides convenience method for creating and
2913 * manipulating DOM elements.
2915 * To import the class in views, use `'require dom'`, to import it in
2916 * external JavaScript, use `L.require("dom").then(...)`.
2918 var DOM = Class.singleton(/* @lends LuCI.dom.prototype */ {
2919 __name__: 'LuCI.dom',
2922 * Tests whether the given argument is a valid DOM `Node`.
2925 * @memberof LuCI.dom
2927 * The value to test.
2929 * @returns {boolean}
2930 * Returns `true` if the value is a DOM `Node`, else `false`.
2933 return (e != null && typeof(e) == 'object' && 'nodeType' in e);
2937 * Parses a given string as HTML and returns the first child node.
2940 * @memberof LuCI.dom
2942 * A string containing an HTML fragment to parse. Note that only
2943 * the first result of the resulting structure is returned, so an
2944 * input value of `<div>foo</div> <div>bar</div>` will only return
2945 * the first `div` element node.
2948 * Returns the first DOM `Node` extracted from the HTML fragment or
2949 * `null` on parsing failures or if no element could be found.
2951 parse: function(s) {
2955 domParser = domParser || new DOMParser();
2956 elem = domParser.parseFromString(s, 'text/html').body.firstChild;
2962 dummyElem = dummyElem || document.createElement('div');
2963 dummyElem.innerHTML = s;
2964 elem = dummyElem.firstChild;
2969 return elem || null;
2973 * Tests whether a given `Node` matches the given query selector.
2975 * This function is a convenience wrapper around the standard
2976 * `Node.matches("selector")` function with the added benefit that
2977 * the `node` argument may be a non-`Node` value, in which case
2978 * this function simply returns `false`.
2981 * @memberof LuCI.dom
2983 * The `Node` argument to test the selector against.
2985 * @param {string} [selector]
2986 * The query selector expression to test against the given node.
2988 * @returns {boolean}
2989 * Returns `true` if the given node matches the specified selector
2990 * or `false` when the node argument is no valid DOM `Node` or the
2991 * selector didn't match.
2993 matches: function(node, selector) {
2994 var m = this.elem(node) ? node.matches || node.msMatchesSelector : null;
2995 return m ? m.call(node, selector) : false;
2999 * Returns the closest parent node that matches the given query
3000 * selector expression.
3002 * This function is a convenience wrapper around the standard
3003 * `Node.closest("selector")` function with the added benefit that
3004 * the `node` argument may be a non-`Node` value, in which case
3005 * this function simply returns `null`.
3008 * @memberof LuCI.dom
3010 * The `Node` argument to find the closest parent for.
3012 * @param {string} [selector]
3013 * The query selector expression to test against each parent.
3015 * @returns {Node|null}
3016 * Returns the closest parent node matching the selector or
3017 * `null` when the node argument is no valid DOM `Node` or the
3018 * selector didn't match any parent.
3020 parent: function(node, selector) {
3021 if (this.elem(node) && node.closest)
3022 return node.closest(selector);
3024 while (this.elem(node))
3025 if (this.matches(node, selector))
3028 node = node.parentNode;
3034 * Appends the given children data to the given node.
3037 * @memberof LuCI.dom
3039 * The `Node` argument to append the children to.
3041 * @param {*} [children]
3042 * The childrens to append to the given node.
3044 * When `children` is an array, then each item of the array
3045 * will be either appended as child element or text node,
3046 * depending on whether the item is a DOM `Node` instance or
3047 * some other non-`null` value. Non-`Node`, non-`null` values
3048 * will be converted to strings first before being passed as
3049 * argument to `createTextNode()`.
3051 * When `children` is a function, it will be invoked with
3052 * the passed `node` argument as sole parameter and the `append`
3053 * function will be invoked again, with the given `node` argument
3054 * as first and the return value of the `children` function as
3057 * When `children` is is a DOM `Node` instance, it will be
3058 * appended to the given `node`.
3060 * When `children` is any other non-`null` value, it will be
3061 * converted to a string and appened to the `innerHTML` property
3062 * of the given `node`.
3064 * @returns {Node|null}
3065 * Returns the last children `Node` appended to the node or `null`
3066 * if either the `node` argument was no valid DOM `node` or if the
3067 * `children` was `null` or didn't result in further DOM nodes.
3069 append: function(node, children) {
3070 if (!this.elem(node))
3073 if (Array.isArray(children)) {
3074 for (var i = 0; i < children.length; i++)
3075 if (this.elem(children[i]))
3076 node.appendChild(children[i]);
3077 else if (children !== null && children !== undefined)
3078 node.appendChild(document.createTextNode('' + children[i]));
3080 return node.lastChild;
3082 else if (typeof(children) === 'function') {
3083 return this.append(node, children(node));
3085 else if (this.elem(children)) {
3086 return node.appendChild(children);
3088 else if (children !== null && children !== undefined) {
3089 node.innerHTML = '' + children;
3090 return node.lastChild;
3097 * Replaces the content of the given node with the given children.
3099 * This function first removes any children of the given DOM
3100 * `Node` and then adds the given given children following the
3101 * rules outlined below.
3104 * @memberof LuCI.dom
3106 * The `Node` argument to replace the children of.
3108 * @param {*} [children]
3109 * The childrens to replace into the given node.
3111 * When `children` is an array, then each item of the array
3112 * will be either appended as child element or text node,
3113 * depending on whether the item is a DOM `Node` instance or
3114 * some other non-`null` value. Non-`Node`, non-`null` values
3115 * will be converted to strings first before being passed as
3116 * argument to `createTextNode()`.
3118 * When `children` is a function, it will be invoked with
3119 * the passed `node` argument as sole parameter and the `append`
3120 * function will be invoked again, with the given `node` argument
3121 * as first and the return value of the `children` function as
3124 * When `children` is is a DOM `Node` instance, it will be
3125 * appended to the given `node`.
3127 * When `children` is any other non-`null` value, it will be
3128 * converted to a string and appened to the `innerHTML` property
3129 * of the given `node`.
3131 * @returns {Node|null}
3132 * Returns the last children `Node` appended to the node or `null`
3133 * if either the `node` argument was no valid DOM `node` or if the
3134 * `children` was `null` or didn't result in further DOM nodes.
3136 content: function(node, children) {
3137 if (!this.elem(node))
3140 var dataNodes = node.querySelectorAll('[data-idref]');
3142 for (var i = 0; i < dataNodes.length; i++)
3143 delete this.registry[dataNodes[i].getAttribute('data-idref')];
3145 while (node.firstChild)
3146 node.removeChild(node.firstChild);
3148 return this.append(node, children);
3152 * Sets attributes or registers event listeners on element nodes.
3155 * @memberof LuCI.dom
3157 * The `Node` argument to set the attributes or add the event
3158 * listeners for. When the given `node` value is not a valid
3159 * DOM `Node`, the function returns and does nothing.
3161 * @param {string|Object<string, *>} key
3162 * Specifies either the attribute or event handler name to use,
3163 * or an object containing multiple key, value pairs which are
3164 * each added to the node as either attribute or event handler,
3165 * depending on the respective value.
3168 * Specifies the attribute value or event handler function to add.
3169 * If the `key` parameter is an `Object`, this parameter will be
3172 * When `val` is of type function, it will be registered as event
3173 * handler on the given `node` with the `key` parameter being the
3176 * When `val` is of type object, it will be serialized as JSON and
3177 * added as attribute to the given `node`, using the given `key`
3178 * as attribute name.
3180 * When `val` is of any other type, it will be added as attribute
3181 * to the given `node` as-is, with the underlying `setAttribute()`
3182 * call implicitely turning it into a string.
3184 attr: function(node, key, val) {
3185 if (!this.elem(node))
3190 if (typeof(key) === 'object' && key !== null)
3192 else if (typeof(key) === 'string')
3193 attr = {}, attr[key] = val;
3196 if (!attr.hasOwnProperty(key) || attr[key] == null)
3199 switch (typeof(attr[key])) {
3201 node.addEventListener(key, attr[key]);
3205 node.setAttribute(key, JSON.stringify(attr[key]));
3209 node.setAttribute(key, attr[key]);
3215 * Creates a new DOM `Node` from the given `html`, `attr` and
3216 * `data` parameters.
3218 * This function has multiple signatures, it can be either invoked
3219 * in the form `create(html[, attr[, data]])` or in the form
3220 * `create(html[, data])`. The used variant is determined from the
3221 * type of the second argument.
3224 * @memberof LuCI.dom
3226 * Describes the node to create.
3228 * When the value of `html` is of type array, a `DocumentFragment`
3229 * node is created and each item of the array is first converted
3230 * to a DOM `Node` by passing it through `create()` and then added
3231 * as child to the fragment.
3233 * When the value of `html` is a DOM `Node` instance, no new
3234 * element will be created but the node will be used as-is.
3236 * When the value of `html` is a string starting with `<`, it will
3237 * be passed to `dom.parse()` and the resulting value is used.
3239 * When the value of `html` is any other string, it will be passed
3240 * to `document.createElement()` for creating a new DOM `Node` of
3243 * @param {Object<string, *>} [attr]
3244 * Specifies an Object of key, value pairs to set as attributes
3245 * or event handlers on the created node. Refer to
3246 * {@link LuCI.dom#attr dom.attr()} for details.
3249 * Specifies children to append to the newly created element.
3250 * Refer to {@link LuCI.dom#append dom.append()} for details.
3252 * @throws {InvalidCharacterError}
3253 * Throws an `InvalidCharacterError` when the given `html`
3254 * argument contained malformed markup (such as not escaped
3255 * `&` characters in XHTML mode) or when the given node name
3256 * in `html` contains characters which are not legal in DOM
3257 * element names, such as spaces.
3260 * Returns the newly created `Node`.
3262 create: function() {
3263 var html = arguments[0],
3264 attr = arguments[1],
3265 data = arguments[2],
3268 if (!(attr instanceof Object) || Array.isArray(attr))
3269 data = attr, attr = null;
3271 if (Array.isArray(html)) {
3272 elem = document.createDocumentFragment();
3273 for (var i = 0; i < html.length; i++)
3274 elem.appendChild(this.create(html[i]));
3276 else if (this.elem(html)) {
3279 else if (html.charCodeAt(0) === 60) {
3280 elem = this.parse(html);
3283 elem = document.createElement(html);
3289 this.attr(elem, attr);
3290 this.append(elem, data);
3298 * Attaches or detaches arbitrary data to and from a DOM `Node`.
3300 * This function is useful to attach non-string values or runtime
3301 * data that is not serializable to DOM nodes. To decouple data
3302 * from the DOM, values are not added directly to nodes, but
3303 * inserted into a registry instead which is then referenced by a
3304 * string key stored as `data-idref` attribute in the node.
3306 * This function has multiple signatures and is sensitive to the
3307 * number of arguments passed to it.
3309 * - `dom.data(node)` -
3310 * Fetches all data associated with the given node.
3311 * - `dom.data(node, key)` -
3312 * Fetches a specific key associated with the given node.
3313 * - `dom.data(node, key, val)` -
3314 * Sets a specific key to the given value associated with the
3316 * - `dom.data(node, null)` -
3317 * Clears any data associated with the node.
3318 * - `dom.data(node, key, null)` -
3319 * Clears the given key associated with the node.
3322 * @memberof LuCI.dom
3323 * @param {Node} node
3324 * The DOM `Node` instance to set or retrieve the data for.
3326 * @param {string|null} [key]
3327 * This is either a string specifying the key to retrieve, or
3328 * `null` to unset the entire node data.
3330 * @param {*|null} [val]
3331 * This is either a non-`null` value to set for a given key or
3332 * `null` to remove the given `key` from the specified node.
3335 * Returns the get or set value, or `null` when no value could
3338 data: function(node, key, val) {
3339 if (!node || !node.getAttribute)
3342 var id = node.getAttribute('data-idref');
3344 /* clear all data */
3345 if (arguments.length > 1 && key == null) {
3347 node.removeAttribute('data-idref');
3348 val = this.registry[id]
3349 delete this.registry[id];
3357 else if (arguments.length > 2 && key != null && val == null) {
3359 val = this.registry[id][key];
3360 delete this.registry[id][key];
3368 else if (arguments.length > 2 && key != null && val != null) {
3370 do { id = Math.floor(Math.random() * 0xffffffff).toString(16) }
3371 while (this.registry.hasOwnProperty(id));
3373 node.setAttribute('data-idref', id);
3374 this.registry[id] = {};
3377 return (this.registry[id][key] = val);
3381 else if (arguments.length == 1) {
3383 return this.registry[id];
3389 else if (arguments.length == 2) {
3391 return this.registry[id][key];
3398 * Binds the given class instance ot the specified DOM `Node`.
3400 * This function uses the `dom.data()` facility to attach the
3401 * passed instance of a Class to a node. This is needed for
3402 * complex widget elements or similar where the corresponding
3403 * class instance responsible for the element must be retrieved
3404 * from DOM nodes obtained by `querySelector()` or similar means.
3407 * @memberof LuCI.dom
3408 * @param {Node} node
3409 * The DOM `Node` instance to bind the class to.
3411 * @param {Class} inst
3412 * The Class instance to bind to the node.
3414 * @throws {TypeError}
3415 * Throws a `TypeError` when the given instance argument isn't
3416 * a valid Class instance.
3419 * Returns the bound class instance.
3421 bindClassInstance: function(node, inst) {
3422 if (!(inst instanceof Class))
3423 L.error('TypeError', 'Argument must be a class instance');
3425 return this.data(node, '_class', inst);
3429 * Finds a bound class instance on the given node itself or the
3430 * first bound instance on its closest parent node.
3433 * @memberof LuCI.dom
3434 * @param {Node} node
3435 * The DOM `Node` instance to start from.
3437 * @returns {Class|null}
3438 * Returns the founds class instance if any or `null` if no bound
3439 * class could be found on the node itself or any of its parents.
3441 findClassInstance: function(node) {
3445 inst = this.data(node, '_class');
3446 node = node.parentNode;
3448 while (!(inst instanceof Class) && node != null);
3454 * Finds a bound class instance on the given node itself or the
3455 * first bound instance on its closest parent node and invokes
3456 * the specified method name on the found class instance.
3459 * @memberof LuCI.dom
3460 * @param {Node} node
3461 * The DOM `Node` instance to start from.
3463 * @param {string} method
3464 * The name of the method to invoke on the found class instance.
3466 * @param {...*} params
3467 * Additional arguments to pass to the invoked method as-is.
3470 * Returns the return value of the invoked method if a class
3471 * instance and method has been found. Returns `null` if either
3472 * no bound class instance could be found, or if the found
3473 * instance didn't have the requested `method`.
3475 callClassMethod: function(node, method /*, ... */) {
3476 var inst = this.findClassInstance(node);
3478 if (inst == null || typeof(inst[method]) != 'function')
3481 return inst[method].apply(inst, inst.varargs(arguments, 2));
3485 * The ignore callback function is invoked by `isEmpty()` for each
3486 * child node to decide whether to ignore a child node or not.
3488 * When this function returns `false`, the node passed to it is
3489 * ignored, else not.
3491 * @callback LuCI.dom~ignoreCallbackFn
3492 * @param {Node} node
3493 * The child node to test.
3495 * @returns {boolean}
3496 * Boolean indicating whether to ignore the node or not.
3500 * Tests whether a given DOM `Node` instance is empty or appears
3503 * Any element child nodes which have the CSS class `hidden` set
3504 * or for which the optionally passed `ignoreFn` callback function
3505 * returns `false` are ignored.
3508 * @memberof LuCI.dom
3509 * @param {Node} node
3510 * The DOM `Node` instance to test.
3512 * @param {LuCI.dom~ignoreCallbackFn} [ignoreFn]
3513 * Specifies an optional function which is invoked for each child
3514 * node to decide whether the child node should be ignored or not.
3516 * @returns {boolean}
3517 * Returns `true` if the node does not have any children or if
3518 * any children node either has a `hidden` CSS class or a `false`
3519 * result when testing it using the given `ignoreFn`.
3521 isEmpty: function(node, ignoreFn) {
3522 for (var child = node.firstElementChild; child != null; child = child.nextElementSibling)
3523 if (!child.classList.contains('hidden') && (!ignoreFn || !ignoreFn(child)))
3536 * The `view` class forms the basis of views and provides a standard
3537 * set of methods to inherit from.
3539 var View = Class.extend(/* @lends LuCI.view.prototype */ {
3540 __name__: 'LuCI.view',
3542 __init__: function() {
3543 var vp = document.getElementById('view');
3545 DOM.content(vp, E('div', { 'class': 'spinning' }, _('Loading view…')));
3547 return Promise.resolve(this.load())
3548 .then(L.bind(this.render, this))
3549 .then(L.bind(function(nodes) {
3550 var vp = document.getElementById('view');
3552 DOM.content(vp, nodes);
3553 DOM.append(vp, this.addFooter());
3554 }, this)).catch(L.error);
3558 * The load function is invoked before the view is rendered.
3560 * The invocation of this function is wrapped by
3561 * `Promise.resolve()` so it may return Promises if needed.
3563 * The return value of the function (or the resolved values
3564 * of the promise returned by it) will be passed as first
3565 * argument to `render()`.
3567 * This function is supposed to be overwritten by subclasses,
3568 * the default implementation does nothing.
3572 * @memberof LuCI.view
3574 * @returns {*|Promise<*>}
3575 * May return any value or a Promise resolving to any value.
3577 load: function() {},
3580 * The render function is invoked after the
3581 * {@link LuCI.view#load load()} function and responsible
3582 * for setting up the view contents. It must return a DOM
3583 * `Node` or `DocumentFragment` holding the contents to
3584 * insert into the view area.
3586 * The invocation of this function is wrapped by
3587 * `Promise.resolve()` so it may return Promises if needed.
3589 * The return value of the function (or the resolved values
3590 * of the promise returned by it) will be inserted into the
3591 * main content area using
3592 * {@link LuCI.dom#append dom.append()}.
3594 * This function is supposed to be overwritten by subclasses,
3595 * the default implementation does nothing.
3599 * @memberof LuCI.view
3600 * @param {*|null} load_results
3601 * This function will receive the return value of the
3602 * {@link LuCI.view#load view.load()} function as first
3605 * @returns {Node|Promise<Node>}
3606 * Should return a DOM `Node` value or a `Promise` resolving
3607 * to a `Node` value.
3609 render: function() {},
3612 * The handleSave function is invoked when the user clicks
3613 * the `Save` button in the page action footer.
3615 * The default implementation should be sufficient for most
3616 * views using {@link form#Map form.Map()} based forms - it
3617 * will iterate all forms present in the view and invoke
3618 * the {@link form#Map#save Map.save()} method on each form.
3620 * Views not using `Map` instances or requiring other special
3621 * logic should overwrite `handleSave()` with a custom
3624 * To disable the `Save` page footer button, views extending
3625 * this base class should overwrite the `handleSave` function
3628 * The invocation of this function is wrapped by
3629 * `Promise.resolve()` so it may return Promises if needed.
3632 * @memberof LuCI.view
3634 * The DOM event that triggered the function.
3636 * @returns {*|Promise<*>}
3637 * Any return values of this function are discarded, but
3638 * passed through `Promise.resolve()` to ensure that any
3639 * returned promise runs to completion before the button
3642 handleSave: function(ev) {
3645 document.getElementById('maincontent')
3646 .querySelectorAll('.cbi-map').forEach(function(map) {
3647 tasks.push(DOM.callClassMethod(map, 'save'));
3650 return Promise.all(tasks);
3654 * The handleSaveApply function is invoked when the user clicks
3655 * the `Save & Apply` button in the page action footer.
3657 * The default implementation should be sufficient for most
3658 * views using {@link form#Map form.Map()} based forms - it
3660 * {@link LuCI.view.handleSave view.handleSave()} and then
3661 * call {@link ui#changes#apply ui.changes.apply()} to start the
3662 * modal config apply and page reload flow.
3664 * Views not using `Map` instances or requiring other special
3665 * logic should overwrite `handleSaveApply()` with a custom
3668 * To disable the `Save & Apply` page footer button, views
3669 * extending this base class should overwrite the
3670 * `handleSaveApply` function with `null`.
3672 * The invocation of this function is wrapped by
3673 * `Promise.resolve()` so it may return Promises if needed.
3676 * @memberof LuCI.view
3678 * The DOM event that triggered the function.
3680 * @returns {*|Promise<*>}
3681 * Any return values of this function are discarded, but
3682 * passed through `Promise.resolve()` to ensure that any
3683 * returned promise runs to completion before the button
3686 handleSaveApply: function(ev, mode) {
3687 return this.handleSave(ev).then(function() {
3688 L.ui.changes.apply(mode == '0');
3693 * The handleReset function is invoked when the user clicks
3694 * the `Reset` button in the page action footer.
3696 * The default implementation should be sufficient for most
3697 * views using {@link form#Map form.Map()} based forms - it
3698 * will iterate all forms present in the view and invoke
3699 * the {@link form#Map#save Map.reset()} method on each form.
3701 * Views not using `Map` instances or requiring other special
3702 * logic should overwrite `handleReset()` with a custom
3705 * To disable the `Reset` page footer button, views extending
3706 * this base class should overwrite the `handleReset` function
3709 * The invocation of this function is wrapped by
3710 * `Promise.resolve()` so it may return Promises if needed.
3713 * @memberof LuCI.view
3715 * The DOM event that triggered the function.
3717 * @returns {*|Promise<*>}
3718 * Any return values of this function are discarded, but
3719 * passed through `Promise.resolve()` to ensure that any
3720 * returned promise runs to completion before the button
3723 handleReset: function(ev) {
3726 document.getElementById('maincontent')
3727 .querySelectorAll('.cbi-map').forEach(function(map) {
3728 tasks.push(DOM.callClassMethod(map, 'reset'));
3731 return Promise.all(tasks);
3735 * Renders a standard page action footer if any of the
3736 * `handleSave()`, `handleSaveApply()` or `handleReset()`
3737 * functions are defined.
3739 * The default implementation should be sufficient for most
3740 * views - it will render a standard page footer with action
3741 * buttons labeled `Save`, `Save & Apply` and `Reset`
3742 * triggering the `handleSave()`, `handleSaveApply()` and
3743 * `handleReset()` functions respectively.
3745 * When any of these `handle*()` functions is overwritten
3746 * with `null` by a view extending this class, the
3747 * corresponding button will not be rendered.
3750 * @memberof LuCI.view
3751 * @returns {DocumentFragment}
3752 * Returns a `DocumentFragment` containing the footer bar
3753 * with buttons for each corresponding `handle*()` action
3754 * or an empty `DocumentFragment` if all three `handle*()`
3755 * methods are overwritten with `null`.
3757 addFooter: function() {
3760 var saveApplyBtn = this.handleSaveApply ? new L.ui.ComboButton('0', {
3761 0: [ _('Save & Apply') ],
3762 1: [ _('Apply unchecked') ]
3765 0: 'btn cbi-button cbi-button-apply important',
3766 1: 'btn cbi-button cbi-button-negative important'
3768 click: L.ui.createHandlerFn(this, 'handleSaveApply')
3769 }).render() : E([]);
3771 if (this.handleSaveApply || this.handleSave || this.handleReset) {
3772 footer.appendChild(E('div', { 'class': 'cbi-page-actions control-group' }, [
3774 this.handleSave ? E('button', {
3775 'class': 'cbi-button cbi-button-save',
3776 'click': L.ui.createHandlerFn(this, 'handleSave')
3777 }, [ _('Save') ]) : '', ' ',
3778 this.handleReset ? E('button', {
3779 'class': 'cbi-button cbi-button-reset',
3780 'click': L.ui.createHandlerFn(this, 'handleReset')
3781 }, [ _('Reset') ]) : ''
3790 var dummyElem = null,
3792 originalCBIInit = null,
3796 /* "preload" builtin classes to make the available via require */
3805 var LuCI = Class.extend(/** @lends LuCI.prototype */ {
3807 __init__: function(env) {
3809 document.querySelectorAll('script[src*="/luci.js"]').forEach(function(s) {
3810 if (env.base_url == null || env.base_url == '') {
3811 var m = (s.getAttribute('src') || '').match(/^(.*)\/luci\.js(?:\?v=([^?]+))?$/);
3813 env.base_url = m[1];
3814 env.resource_version = m[2];
3819 if (env.base_url == null)
3820 this.error('InternalError', 'Cannot find url of luci.js');
3822 env.cgi_base = env.scriptname.replace(/\/[^\/]+$/, '');
3824 Object.assign(this.env, env);
3826 document.addEventListener('poll-start', function(ev) {
3827 document.querySelectorAll('[id^="xhr_poll_status"]').forEach(function(e) {
3828 e.style.display = (e.id == 'xhr_poll_status_off') ? 'none' : '';
3832 document.addEventListener('poll-stop', function(ev) {
3833 document.querySelectorAll('[id^="xhr_poll_status"]').forEach(function(e) {
3834 e.style.display = (e.id == 'xhr_poll_status_on') ? 'none' : '';
3838 var domReady = new Promise(function(resolveFn, rejectFn) {
3839 document.addEventListener('DOMContentLoaded', resolveFn);
3845 this.require('rpc'),
3846 this.require('form'),
3847 this.probeRPCBaseURL()
3848 ]).then(this.setupDOM.bind(this)).catch(this.error);
3850 originalCBIInit = window.cbi_init;
3851 window.cbi_init = function() {};
3855 * Captures the current stack trace and throws an error of the
3856 * specified type as a new exception. Also logs the exception as
3857 * error to the debug console if it is available.
3862 * @param {Error|string} [type=Error]
3863 * Either a string specifying the type of the error to throw or an
3864 * existing `Error` instance to copy.
3866 * @param {string} [fmt=Unspecified error]
3867 * A format string which is used to form the error message, together
3868 * with all subsequent optional arguments.
3870 * @param {...*} [args]
3871 * Zero or more variable arguments to the supplied format string.
3874 * Throws the created error object with the captured stack trace
3875 * appended to the message and the type set to the given type
3876 * argument or copied from the given error instance.
3878 raise: function(type, fmt /*, ...*/) {
3880 msg = fmt ? String.prototype.format.apply(fmt, this.varargs(arguments, 2)) : null,
3883 if (type instanceof Error) {
3887 e.message = msg + ': ' + e.message;
3890 try { throw new Error('stacktrace') }
3891 catch (e2) { stack = (e2.stack || '').split(/\n/) }
3893 e = new (window[type || 'Error'] || Error)(msg || 'Unspecified error');
3894 e.name = type || 'Error';
3897 stack = (stack || []).map(function(frame) {
3898 frame = frame.replace(/(.*?)@(.+):(\d+):(\d+)/g, 'at $1 ($2:$3:$4)').trim();
3899 return frame ? ' ' + frame : '';
3902 if (!/^ at /.test(stack[0]))
3905 if (/\braise /.test(stack[0]))
3908 if (/\berror /.test(stack[0]))
3912 e.message += '\n' + stack.join('\n');
3914 if (window.console && console.debug)
3921 * A wrapper around {@link LuCI#raise raise()} which also renders
3922 * the error either as modal overlay when `ui.js` is already loaed
3923 * or directly into the view body.
3928 * @param {Error|string} [type=Error]
3929 * Either a string specifying the type of the error to throw or an
3930 * existing `Error` instance to copy.
3932 * @param {string} [fmt=Unspecified error]
3933 * A format string which is used to form the error message, together
3934 * with all subsequent optional arguments.
3936 * @param {...*} [args]
3937 * Zero or more variable arguments to the supplied format string.
3940 * Throws the created error object with the captured stack trace
3941 * appended to the message and the type set to the given type
3942 * argument or copied from the given error instance.
3944 error: function(type, fmt /*, ...*/) {
3946 L.raise.apply(L, Array.prototype.slice.call(arguments));
3951 L.ui.addNotification(e.name || _('Runtime error'),
3952 E('pre', {}, e.message), 'danger');
3954 DOM.content(document.querySelector('#maincontent'),
3955 E('pre', { 'class': 'alert-message error' }, e.message));
3965 * Return a bound function using the given `self` as `this` context
3966 * and any further arguments as parameters to the bound function.
3971 * @param {function} fn
3972 * The function to bind.
3975 * The value to bind as `this` context to the specified function.
3977 * @param {...*} [args]
3978 * Zero or more variable arguments which are bound to the function
3981 * @returns {function}
3982 * Returns the bound function.
3984 bind: function(fn, self /*, ... */) {
3985 return Function.prototype.bind.apply(fn, this.varargs(arguments, 2, self));
3989 * Load an additional LuCI JavaScript class and its dependencies,
3990 * instantiate it and return the resulting class instance. Each
3991 * class is only loaded once. Subsequent attempts to load the same
3992 * class will return the already instantiated class.
3997 * @param {string} name
3998 * The name of the class to load in dotted notation. Dots will
3999 * be replaced by spaces and joined with the runtime-determined
4000 * base URL of LuCI.js to form an absolute URL to load the class
4003 * @throws {DependencyError}
4004 * Throws a `DependencyError` when the class to load includes
4005 * circular dependencies.
4007 * @throws {NetworkError}
4008 * Throws `NetworkError` when the underlying {@link LuCI.request}
4011 * @throws {SyntaxError}
4012 * Throws `SyntaxError` when the loaded class file code cannot
4013 * be interpreted by `eval`.
4015 * @throws {TypeError}
4016 * Throws `TypeError` when the class file could be loaded and
4017 * interpreted, but when invoking its code did not yield a valid
4020 * @returns {Promise<LuCI.baseclass>}
4021 * Returns the instantiated class.
4023 require: function(name, from) {
4024 var L = this, url = null, from = from || [];
4026 /* Class already loaded */
4027 if (classes[name] != null) {
4028 /* Circular dependency */
4029 if (from.indexOf(name) != -1)
4030 L.raise('DependencyError',
4031 'Circular dependency: class "%s" depends on "%s"',
4032 name, from.join('" which depends on "'));
4034 return Promise.resolve(classes[name]);
4037 url = '%s/%s.js%s'.format(L.env.base_url, name.replace(/\./g, '/'), (L.env.resource_version ? '?v=' + L.env.resource_version : ''));
4038 from = [ name ].concat(from);
4040 var compileClass = function(res) {
4042 L.raise('NetworkError',
4043 'HTTP error %d while loading class file "%s"', res.status, url);
4045 var source = res.text(),
4046 requirematch = /^require[ \t]+(\S+)(?:[ \t]+as[ \t]+([a-zA-Z_]\S*))?$/,
4047 strictmatch = /^use[ \t]+strict$/,
4051 /* find require statements in source */
4052 for (var i = 0, off = -1, quote = -1, esc = false; i < source.length; i++) {
4053 var chr = source.charCodeAt(i);
4058 else if (chr == 92) {
4061 else if (chr == quote) {
4062 var s = source.substring(off, i),
4063 m = requirematch.exec(s);
4066 var dep = m[1], as = m[2] || dep.replace(/[^a-zA-Z0-9_]/g, '_');
4067 depends.push(L.require(dep, from));
4070 else if (!strictmatch.exec(s)) {
4077 else if (quote == -1 && (chr == 34 || chr == 39)) {
4083 /* load dependencies and instantiate class */
4084 return Promise.all(depends).then(function(instances) {
4085 var _factory, _class;
4089 '(function(window, document, L%s) { %s })\n\n//# sourceURL=%s\n'
4090 .format(args, source, res.url));
4093 L.raise('SyntaxError', '%s\n in %s:%s',
4094 error.message, res.url, error.lineNumber || '?');
4097 _factory.displayName = toCamelCase(name + 'ClassFactory');
4098 _class = _factory.apply(_factory, [window, document, L].concat(instances));
4100 if (!Class.isSubclass(_class))
4101 L.error('TypeError', '"%s" factory yields invalid constructor', name);
4103 if (_class.displayName == 'AnonymousClass')
4104 _class.displayName = toCamelCase(name + 'Class');
4106 var ptr = Object.getPrototypeOf(L),
4107 parts = name.split(/\./),
4108 instance = new _class();
4110 for (var i = 0; ptr && i < parts.length - 1; i++)
4111 ptr = ptr[parts[i]];
4114 ptr[parts[i]] = instance;
4116 classes[name] = instance;
4122 /* Request class file */
4123 classes[name] = Request.get(url, { cache: true }).then(compileClass);
4125 return classes[name];
4129 probeRPCBaseURL: function() {
4130 if (rpcBaseURL == null) {
4132 rpcBaseURL = window.sessionStorage.getItem('rpcBaseURL');
4137 if (rpcBaseURL == null) {
4138 var rpcFallbackURL = this.url('admin/ubus');
4140 rpcBaseURL = Request.get(this.env.ubuspath).then(function(res) {
4141 return (rpcBaseURL = (res.status == 400) ? L.env.ubuspath : rpcFallbackURL);
4143 return (rpcBaseURL = rpcFallbackURL);
4144 }).then(function(url) {
4146 window.sessionStorage.setItem('rpcBaseURL', url);
4154 return Promise.resolve(rpcBaseURL);
4157 probeSystemFeatures: function() {
4158 var sessionid = classes.rpc.getSessionID();
4160 if (sysFeatures == null) {
4162 var data = JSON.parse(window.sessionStorage.getItem('sysFeatures'));
4164 if (this.isObject(data) && this.isObject(data[sessionid]))
4165 sysFeatures = data[sessionid];
4170 if (!this.isObject(sysFeatures)) {
4171 sysFeatures = classes.rpc.declare({
4173 method: 'getFeatures',
4175 })().then(function(features) {
4178 data[sessionid] = features;
4180 window.sessionStorage.setItem('sysFeatures', JSON.stringify(data));
4184 sysFeatures = features;
4190 return Promise.resolve(sysFeatures);
4194 * Test whether a particular system feature is available, such as
4195 * hostapd SAE support or an installed firewall. The features are
4196 * queried once at the beginning of the LuCI session and cached in
4197 * `SessionStorage` throughout the lifetime of the associated tab or
4203 * @param {string} feature
4204 * The feature to test. For detailed list of known feature flags,
4205 * see `/modules/luci-base/root/usr/libexec/rpcd/luci`.
4207 * @param {string} [subfeature]
4208 * Some feature classes like `hostapd` provide sub-feature flags,
4209 * such as `sae` or `11w` support. The `subfeature` argument can
4210 * be used to query these.
4212 * @return {boolean|null}
4213 * Return `true` if the queried feature (and sub-feature) is available
4214 * or `false` if the requested feature isn't present or known.
4215 * Return `null` when a sub-feature was queried for a feature which
4216 * has no sub-features.
4218 hasSystemFeature: function() {
4219 var ft = sysFeatures[arguments[0]];
4221 if (arguments.length == 2)
4222 return this.isObject(ft) ? ft[arguments[1]] : null;
4224 return (ft != null && ft != false);
4228 notifySessionExpiry: function() {
4231 L.ui.showModal(_('Session expired'), [
4232 E('div', { class: 'alert-message warning' },
4233 _('A new login is required since the authentication session expired.')),
4234 E('div', { class: 'right' },
4236 class: 'btn primary',
4238 var loc = window.location;
4239 window.location = loc.protocol + '//' + loc.host + loc.pathname + loc.search;
4241 }, _('To login…')))
4244 L.raise('SessionError', 'Login session is expired');
4248 setupDOM: function(res) {
4253 rpcBaseURL = res[4];
4255 rpcClass.setBaseURL(rpcBaseURL);
4257 rpcClass.addInterceptor(function(msg, req) {
4258 if (!L.isObject(msg) || !L.isObject(msg.error) || msg.error.code != -32002)
4261 if (!L.isObject(req) || (req.object == 'session' && req.method == 'access'))
4264 return rpcClass.declare({
4265 'object': 'session',
4267 'params': [ 'scope', 'object', 'function' ],
4268 'expect': { access: true }
4269 })('uci', 'luci', 'read').catch(L.notifySessionExpiry);
4272 Request.addInterceptor(function(res) {
4273 var isDenied = false;
4275 if (res.status == 403 && res.headers.get('X-LuCI-Login-Required') == 'yes')
4281 L.notifySessionExpiry();
4284 return this.probeSystemFeatures().finally(this.initDOM);
4288 initDOM: function() {
4291 document.dispatchEvent(new CustomEvent('luci-loaded'));
4295 * The `env` object holds environment settings used by LuCI, such
4296 * as request timeouts, base URLs etc.
4304 * Construct a relative URL path from the given prefix and parts.
4305 * The resulting URL is guaranteed to only contain the characters
4306 * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well
4307 * as `/` for the path separator.
4312 * @param {string} [prefix]
4313 * The prefix to join the given parts with. If the `prefix` is
4314 * omitted, it defaults to an empty string.
4316 * @param {string[]} [parts]
4317 * An array of parts to join into an URL path. Parts may contain
4318 * slashes and any of the other characters mentioned above.
4321 * Return the joined URL path.
4323 path: function(prefix, parts) {
4324 var url = [ prefix || '' ];
4326 for (var i = 0; i < parts.length; i++)
4327 if (/^(?:[a-zA-Z0-9_.%,;-]+\/)*[a-zA-Z0-9_.%,;-]+$/.test(parts[i]))
4328 url.push('/', parts[i]);
4330 if (url.length === 1)
4333 return url.join('');
4337 * Construct an URL pathrelative to the script path of the server
4338 * side LuCI application (usually `/cgi-bin/luci`).
4340 * The resulting URL is guaranteed to only contain the characters
4341 * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well
4342 * as `/` for the path separator.
4347 * @param {string[]} [parts]
4348 * An array of parts to join into an URL path. Parts may contain
4349 * slashes and any of the other characters mentioned above.
4352 * Returns the resulting URL path.
4355 return this.path(this.env.scriptname, arguments);
4359 * Construct an URL path relative to the global static resource path
4360 * of the LuCI ui (usually `/luci-static/resources`).
4362 * The resulting URL is guaranteed to only contain the characters
4363 * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well
4364 * as `/` for the path separator.
4369 * @param {string[]} [parts]
4370 * An array of parts to join into an URL path. Parts may contain
4371 * slashes and any of the other characters mentioned above.
4374 * Returns the resulting URL path.
4376 resource: function() {
4377 return this.path(this.env.resource, arguments);
4381 * Construct an URL path relative to the media resource path of the
4382 * LuCI ui (usually `/luci-static/$theme_name`).
4384 * The resulting URL is guaranteed to only contain the characters
4385 * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well
4386 * as `/` for the path separator.
4391 * @param {string[]} [parts]
4392 * An array of parts to join into an URL path. Parts may contain
4393 * slashes and any of the other characters mentioned above.
4396 * Returns the resulting URL path.
4399 return this.path(this.env.media, arguments);
4403 * Return the complete URL path to the current view.
4409 * Returns the URL path to the current view.
4411 location: function() {
4412 return this.path(this.env.scriptname, this.env.requestpath);
4417 * Tests whether the passed argument is a JavaScript object.
4418 * This function is meant to be an object counterpart to the
4419 * standard `Array.isArray()` function.
4428 * Returns `true` if the given value is of type object and
4429 * not `null`, else returns `false`.
4431 isObject: function(val) {
4432 return (val != null && typeof(val) == 'object');
4436 * Return an array of sorted object keys, optionally sorted by
4437 * a different key or a different sorting mode.
4442 * @param {object} obj
4443 * The object to extract the keys from. If the given value is
4444 * not an object, the function will return an empty array.
4446 * @param {string} [key]
4447 * Specifies the key to order by. This is mainly useful for
4448 * nested objects of objects or objects of arrays when sorting
4449 * shall not be performed by the primary object keys but by
4450 * some other key pointing to a value within the nested values.
4452 * @param {string} [sortmode]
4453 * May be either `addr` or `num` to override the natural
4454 * lexicographic sorting with a sorting suitable for IP/MAC style
4455 * addresses or numeric values respectively.
4457 * @return {string[]}
4458 * Returns an array containing the sorted keys of the given object.
4460 sortedKeys: function(obj, key, sortmode) {
4461 if (obj == null || typeof(obj) != 'object')
4464 return Object.keys(obj).map(function(e) {
4465 var v = (key != null) ? obj[e][key] : e;
4469 v = (v != null) ? v.replace(/(?:^|[.:])([0-9a-fA-F]{1,4})/g,
4470 function(m0, m1) { return ('000' + m1.toLowerCase()).substr(-4) }) : null;
4474 v = (v != null) ? +v : null;
4479 }).filter(function(e) {
4480 return (e[1] != null);
4481 }).sort(function(a, b) {
4482 return (a[1] > b[1]);
4483 }).map(function(e) {
4489 * Converts the given value to an array. If the given value is of
4490 * type array, it is returned as-is, values of type object are
4491 * returned as one-element array containing the object, empty
4492 * strings and `null` values are returned as empty array, all other
4493 * values are converted using `String()`, trimmed, split on white
4494 * space and returned as array.
4500 * The value to convert into an array.
4502 * @return {Array<*>}
4503 * Returns the resulting array.
4505 toArray: function(val) {
4508 else if (Array.isArray(val))
4510 else if (typeof(val) == 'object')
4513 var s = String(val).trim();
4518 return s.split(/\s+/);
4522 * Returns a promise resolving with either the given value or or with
4523 * the given default in case the input value is a rejecting promise.
4529 * The value to resolve the promise with.
4531 * @param {*} defvalue
4532 * The default value to resolve the promise with in case the given
4533 * input value is a rejecting promise.
4535 * @returns {Promise<*>}
4536 * Returns a new promise resolving either to the given input value or
4537 * to the given default value on error.
4539 resolveDefault: function(value, defvalue) {
4540 return Promise.resolve(value).catch(function() { return defvalue });
4544 * The request callback function is invoked whenever an HTTP
4545 * reply to a request made using the `L.get()`, `L.post()` or
4546 * `L.poll()` function is timed out or received successfully.
4551 * @callback LuCI.requestCallbackFn
4552 * @param {XMLHTTPRequest} xhr
4553 * The XMLHTTPRequest instance used to make the request.
4556 * The response JSON if the response could be parsed as such,
4559 * @param {number} duration
4560 * The total duration of the request in milliseconds.
4564 * Issues a GET request to the given url and invokes the specified
4565 * callback function. The function is a wrapper around
4566 * {@link LuCI.request#request Request.request()}.
4572 * @param {string} url
4573 * The URL to request.
4575 * @param {Object<string, string>} [args]
4576 * Additional query string arguments to append to the URL.
4578 * @param {LuCI.requestCallbackFn} cb
4579 * The callback function to invoke when the request finishes.
4581 * @return {Promise<null>}
4582 * Returns a promise resolving to `null` when concluded.
4584 get: function(url, args, cb) {
4585 return this.poll(null, url, args, cb, false);
4589 * Issues a POST request to the given url and invokes the specified
4590 * callback function. The function is a wrapper around
4591 * {@link LuCI.request#request Request.request()}. The request is
4592 * sent using `application/x-www-form-urlencoded` encoding and will
4593 * contain a field `token` with the current value of `LuCI.env.token`
4600 * @param {string} url
4601 * The URL to request.
4603 * @param {Object<string, string>} [args]
4604 * Additional post arguments to append to the request body.
4606 * @param {LuCI.requestCallbackFn} cb
4607 * The callback function to invoke when the request finishes.
4609 * @return {Promise<null>}
4610 * Returns a promise resolving to `null` when concluded.
4612 post: function(url, args, cb) {
4613 return this.poll(null, url, args, cb, true);
4617 * Register a polling HTTP request that invokes the specified
4618 * callback function. The function is a wrapper around
4619 * {@link LuCI.request.poll#add Request.poll.add()}.
4625 * @param {number} interval
4626 * The poll interval to use. If set to a value less than or equal
4627 * to `0`, it will default to the global poll interval configured
4628 * in `LuCI.env.pollinterval`.
4630 * @param {string} url
4631 * The URL to request.
4633 * @param {Object<string, string>} [args]
4634 * Specifies additional arguments for the request. For GET requests,
4635 * the arguments are appended to the URL as query string, for POST
4636 * requests, they'll be added to the request body.
4638 * @param {LuCI.requestCallbackFn} cb
4639 * The callback function to invoke whenever a request finishes.
4641 * @param {boolean} [post=false]
4642 * When set to `false` or not specified, poll requests will be made
4643 * using the GET method. When set to `true`, POST requests will be
4644 * issued. In case of POST requests, the request body will contain
4645 * an argument `token` with the current value of `LuCI.env.token` by
4646 * default, regardless of the parameters specified with `args`.
4648 * @return {function}
4649 * Returns the internally created function that has been passed to
4650 * {@link LuCI.request.poll#add Request.poll.add()}. This value can
4651 * be passed to {@link LuCI.poll.remove Poll.remove()} to remove the
4654 poll: function(interval, url, args, cb, post) {
4655 if (interval !== null && interval <= 0)
4656 interval = this.env.pollinterval;
4658 var data = post ? { token: this.env.token } : null,
4659 method = post ? 'POST' : 'GET';
4661 if (!/^(?:\/|\S+:\/\/)/.test(url))
4662 url = this.url(url);
4665 data = Object.assign(data || {}, args);
4667 if (interval !== null)
4668 return Request.poll.add(interval, url, { method: method, query: data }, cb);
4670 return Request.request(url, { method: method, query: data })
4671 .then(function(res) {
4673 if (/^application\/json\b/.test(res.headers.get('Content-Type')))
4674 try { json = res.json() } catch(e) {}
4675 cb(res.xhr, json, res.duration);
4680 * Deprecated wrapper around {@link LuCI.poll.remove Poll.remove()}.
4686 * @param {function} entry
4687 * The polling function to remove.
4690 * Returns `true` when the function has been removed or `false` if
4691 * it could not be found.
4693 stop: function(entry) { return Poll.remove(entry) },
4696 * Deprecated wrapper around {@link LuCI.poll.stop Poll.stop()}.
4703 * Returns `true` when the polling loop has been stopped or `false`
4704 * when it didn't run to begin with.
4706 halt: function() { return Poll.stop() },
4709 * Deprecated wrapper around {@link LuCI.poll.start Poll.start()}.
4716 * Returns `true` when the polling loop has been started or `false`
4717 * when it was already running.
4719 run: function() { return Poll.start() },
4722 * Legacy `L.dom` class alias. New view code should use `'require dom';`
4723 * to request the `LuCI.dom` class.
4732 * Legacy `L.view` class alias. New view code should use `'require view';`
4733 * to request the `LuCI.view` class.
4742 * Legacy `L.Poll` class alias. New view code should use `'require poll';`
4743 * to request the `LuCI.poll` class.
4752 * Legacy `L.Request` class alias. New view code should use `'require request';`
4753 * to request the `LuCI.request` class.
4762 * Legacy `L.Class` class alias. New view code should use `'require baseclass';`
4763 * to request the `LuCI.baseclass` class.
4778 * The `LuCI.xhr` class is a legacy compatibility shim for the
4779 * functionality formerly provided by `xhr.js`. It is registered as global
4780 * `window.XHR` symbol for compatibility with legacy code.
4782 * New code should use {@link LuCI.request} instead to implement HTTP
4785 var XHR = Class.extend(/** @lends LuCI.xhr.prototype */ {
4786 __name__: 'LuCI.xhr',
4787 __init__: function() {
4788 if (window.console && console.debug)
4789 console.debug('Direct use XHR() is deprecated, please use L.Request instead');
4792 _response: function(cb, res, json, duration) {
4794 cb(res, json, duration);
4799 * This function is a legacy wrapper around
4800 * {@link LuCI#get LuCI.get()}.
4804 * @memberof LuCI.xhr
4806 * @param {string} url
4807 * The URL to request
4809 * @param {Object} [data]
4810 * Additional query string data
4812 * @param {LuCI.requestCallbackFn} [callback]
4813 * Callback function to invoke on completion
4815 * @param {number} [timeout]
4816 * Request timeout to use
4818 * @return {Promise<null>}
4820 get: function(url, data, callback, timeout) {
4822 L.get(url, data, this._response.bind(this, callback), timeout);
4826 * This function is a legacy wrapper around
4827 * {@link LuCI#post LuCI.post()}.
4831 * @memberof LuCI.xhr
4833 * @param {string} url
4834 * The URL to request
4836 * @param {Object} [data]
4837 * Additional data to append to the request body.
4839 * @param {LuCI.requestCallbackFn} [callback]
4840 * Callback function to invoke on completion
4842 * @param {number} [timeout]
4843 * Request timeout to use
4845 * @return {Promise<null>}
4847 post: function(url, data, callback, timeout) {
4849 L.post(url, data, this._response.bind(this, callback), timeout);
4853 * Cancels a running request.
4855 * This function does not actually cancel the underlying
4856 * `XMLHTTPRequest` request but it sets a flag which prevents the
4857 * invocation of the callback function when the request eventually
4858 * finishes or timed out.
4862 * @memberof LuCI.xhr
4864 cancel: function() { delete this.active },
4867 * Checks the running state of the request.
4871 * @memberof LuCI.xhr
4873 * @returns {boolean}
4874 * Returns `true` if the request is still running or `false` if it
4875 * already completed.
4877 busy: function() { return (this.active === true) },
4880 * Ignored for backwards compatibility.
4882 * This function does nothing.
4886 * @memberof LuCI.xhr
4888 abort: function() {},
4891 * Existing for backwards compatibility.
4893 * This function simply throws an `InternalError` when invoked.
4897 * @memberof LuCI.xhr
4899 * @throws {InternalError}
4900 * Throws an `InternalError` with the message `Not implemented`
4903 send_form: function() { L.error('InternalError', 'Not implemented') },
4906 XHR.get = function() { return window.L.get.apply(window.L, arguments) };
4907 XHR.post = function() { return window.L.post.apply(window.L, arguments) };
4908 XHR.poll = function() { return window.L.poll.apply(window.L, arguments) };
4909 XHR.stop = Request.poll.remove.bind(Request.poll);
4910 XHR.halt = Request.poll.stop.bind(Request.poll);
4911 XHR.run = Request.poll.start.bind(Request.poll);
4912 XHR.running = Request.poll.active.bind(Request.poll);
4916 })(window, document);
4929 Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Fri Apr 03 2020 13:28:08 GMT+0200 (Central European Summer Time)
4933 <script>prettyPrint();</script>
4934 <script src="scripts/jaguar.js"></script>