API: added force() function to force update widgets
New function introduced vicious.force({ widget, }) - widget argument is a table with one or more widgets that will be updated.
This commit is contained in:
parent
95e9a771b9
commit
ee64644ddc
6
README
6
README
|
@ -82,6 +82,12 @@ Enable caching of a widget type:
|
||||||
|
|
||||||
- enable caching of values returned by a widget type
|
- enable caching of values returned by a widget type
|
||||||
|
|
||||||
|
Force update of widgets:
|
||||||
|
vicious.force({ widget, })
|
||||||
|
|
||||||
|
- widget argument is a table with one or more widgets that will be
|
||||||
|
updated
|
||||||
|
|
||||||
|
|
||||||
Power and Caching
|
Power and Caching
|
||||||
-----------------
|
-----------------
|
||||||
|
|
12
init.lua
12
init.lua
|
@ -72,6 +72,7 @@ for i, w in pairs(_M) do
|
||||||
end
|
end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
|
||||||
-- {{{ Local functions
|
-- {{{ Local functions
|
||||||
-- {{{ Update a widget
|
-- {{{ Update a widget
|
||||||
local function update(widget, reg, disablecache)
|
local function update(widget, reg, disablecache)
|
||||||
|
@ -170,6 +171,7 @@ end
|
||||||
-- }}}
|
-- }}}
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
|
||||||
-- {{{ Exposed functions
|
-- {{{ Exposed functions
|
||||||
-- {{{ Register a widget
|
-- {{{ Register a widget
|
||||||
function register(widget, wtype, format, timer, warg)
|
function register(widget, wtype, format, timer, warg)
|
||||||
|
@ -245,6 +247,16 @@ function cache(type)
|
||||||
end
|
end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
-- {{{ Force update of widgets
|
||||||
|
function force(widgets)
|
||||||
|
if type(widgets) == "table" then
|
||||||
|
for _, w in pairs(widgets) do
|
||||||
|
update(w, nil, true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Suspend all widgets
|
-- {{{ Suspend all widgets
|
||||||
function suspend()
|
function suspend()
|
||||||
for w, i in pairs(registered) do
|
for w, i in pairs(registered) do
|
||||||
|
|
Loading…
Reference in New Issue