summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static/resources/xhr.js
AgeCommit message (Collapse)Author
2019-07-07luci-base: luci.js: add HTTP request functionsJo-Philipp Wich
Add a fetch() inspired HTTP request utility class to luci.js and replace the old xhr.js class with a stub using the new request api. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-20modules: use configurable poll intervalFlorian Eckert
Make poll interval configurable. Use option from ---- config core 'main' option pollinterval '5' --- This will only be used if the interval option is less or equal zero. If the poll interval is not configured then a default value of 5 seconds is used. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-11-16luci-base: xhr.js: rework class, handle expired sessionJo-Philipp Wich
Drop very old IE compat code, restructure class, align code style with other files and properly handle JSON mimetypes with charset trailer. Also detect session related 403 errors and show a modal prompting to re-login. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-27luci-base: xhr.js: decode JSON for POST requests as wellJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-13luci-base: xhr: increase poll request timeoutJo-Philipp Wich
Some status requests can take quite some time to finish, the LuCI DSL status information in particular. Since the polling loop code already takes care of not relaunching requests which are already running, increase the per iteration timeout to up to five times the poll interval. This should be sufficient to let most operations complete. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-12luci-base: xhr.js: use JSON.parse() and pass request duration to callbacksJo-Philipp Wich
JSON.parse() is supported on all modern browsers and a far better solution than the hakish and potentially dangerous eval(). Also calculate the duration of request and pass it as 3rd argument to the callback function, this makes it easier to calculate request delays or poll intervals in code using XHR. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-06-22luci-base: xhr.js: defer starting poll queueJo-Philipp Wich
Defer the start of the queue poll loop until the document has been loaded. This allows all XHR.poll() invocations on the page to register their handlers before the first batch of requests is made. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-05luci-base: xhr.js: fix timeout setting with IE 11Jo-Philipp Wich
Internet Explorer 11 requires the timeout to be applied after the open() call, otherwise an invlaid state exception will be raised Fixes aa6c97154 ("luci-base: extend xhr.js") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-26luci-base: extend xhr.jsJo-Philipp Wich
Add timeout options to get() and post() and introduce XHR.stop() to support stopping a poll operation. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-07-22remove request headers that are set automatically by browserDaniel W
2015-01-08Rework LuCI build systemJo-Philipp Wich
* Rename subdirectories to their repective OpenWrt package names * Make each LuCI module its own standalone package * Deploy a shared luci.mk which is used by each module Makefile Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>