Listen for various events in Porla, such as torrents being added, moved, finished, etc.
These are the events supported. The name is the string you pass as the first
on, and the argument is what you get back in your callback
Registers an event handler for an event. When the event triggers, the
is invoked with the event args.
The function returns a
SignalConnection that can be used to disconnect the
event handler at any time. Once disconnected, you need to register the event
again to trigger your callback.
local events = require("events")
local sc = events.on("torrent_added", function(torrent)
-- torrent is a TorrentHandle
local status = torrent:status()
-- sc is a SignalConnection
-- disconnect the event handler immediately - the callback
-- will never be invoked.
SignalConnection represents a connection to a specific event handler.
Disconnects the event handler. The callback will not be invoked again.