From: Paul Spooren Date: Thu, 30 Jan 2025 23:33:46 +0000 (+0000) Subject: luci-mod-status: add `oneshot` handling X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=ffbce6fed77e74e6e18d40fa9dbda3ae5d5eaa8f;p=openwrt-luci.git luci-mod-status: add `oneshot` handling This allows each include to perform an action a single time but doesn't run it on each poll (instead running it once per page load). The function receives all data loaded via the `load` function. Signed-off-by: Paul Spooren --- diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js index da08ec12c2..911c187584 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js @@ -40,6 +40,11 @@ function startPolling(includes, containers) { else if (includes[i].content != null) content = includes[i].content; + if (typeof (includes[i].oneshot) == 'function') { + includes[i].oneshot(results ? results[i] : null); + includes[i].oneshot = null; + } + if (content != null) { containers[i].parentNode.style.display = ''; containers[i].parentNode.classList.add('fade-in');