add anoia.nl, a convenience wrapper on netlink
This commit is contained in:
15
pkgs/anoia/nl.fnl
Normal file
15
pkgs/anoia/nl.fnl
Normal file
@@ -0,0 +1,15 @@
|
||||
(local netlink (require :netlink))
|
||||
|
||||
(local { : view } (require :fennel))
|
||||
|
||||
(fn events [groups]
|
||||
(let [sock (netlink.socket)]
|
||||
(coroutine.wrap
|
||||
(fn []
|
||||
(each [_ e (ipairs (sock:query groups))]
|
||||
(coroutine.yield e))
|
||||
(while (sock:poll)
|
||||
(each [_ e (ipairs (sock:event))]
|
||||
(coroutine.yield e)))))))
|
||||
|
||||
{ : events }
|
Reference in New Issue
Block a user