diff options
| author | Jo-Philipp Wich <jo@mein.io> | 2020-04-02 21:40:50 +0200 |
|---|---|---|
| committer | Jo-Philipp Wich <jo@mein.io> | 2020-04-02 21:51:20 +0200 |
| commit | 711f75927849fade74f79e4b198b3a839d9d4fbc (patch) | |
| tree | c10818bdadf9e70b856c0581c3f7c52b5e86a9ad /modules/luci-base/htdocs/luci-static/resources/rpc.js | |
| parent | 994e1f3890cd826cb85499928238772e4ab9563c (diff) | |
luci-base: harmonize JS class naming and requesting
- Make builtin classes available via `require` to allow view code to
request external and internal classes in a consistent manner without
having to know which classes are builtin and which not
- Make base classes request any used class explicitely instead of
relying on implicitly set up L.{dom,view,Poll,Request,Class} aliases
- Consistently convert class names to lower case in JSdoc to match
the names used in `require` statements
- Deprecate L.{dom,view,Poll,Request,Class} aliases
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources/rpc.js')
| -rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/rpc.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/rpc.js b/modules/luci-base/htdocs/luci-static/resources/rpc.js index 9b642444fa..20b77c18fc 100644 --- a/modules/luci-base/htdocs/luci-static/resources/rpc.js +++ b/modules/luci-base/htdocs/luci-static/resources/rpc.js @@ -1,4 +1,6 @@ 'use strict'; +'require baseclass'; +'require request'; var rpcRequestID = 1, rpcSessionID = L.env.sessionid || '00000000000000000000000000000000', @@ -14,7 +16,7 @@ var rpcRequestID = 1, * The `LuCI.rpc` class provides high level ubus JSON-RPC abstractions * and means for listing and invoking remove RPC methods. */ -return L.Class.extend(/** @lends LuCI.rpc.prototype */ { +return baseclass.extend(/** @lends LuCI.rpc.prototype */ { /* privates */ call: function(req, cb, nobatch) { var q = ''; @@ -35,7 +37,7 @@ return L.Class.extend(/** @lends LuCI.rpc.prototype */ { q += '/%s.%s'.format(req.params[1], req.params[2]); } - return L.Request.post(rpcBaseURL + q, req, { + return request.post(rpcBaseURL + q, req, { timeout: (L.env.rpctimeout || 20) * 1000, nobatch: nobatch, credentials: true |
