porla_events
Emits events for various things in Porla.
Exports
on(event: string, callback: function): void
v1.0
Registers an event handler for the given event. Check each event type below for the type of callback.
Example
local events = require("porla_events")
events.on("torrent.added" function(torrent)
local status = torrent:status()
print("torrent {} added", status.name)
end)
Events
torrent.added: (LtTorrentHandle)
v1.0
Emitted when a torrent is added to a session.
torrent.file_error: (LtTorrentHandle, string)
Emitted when a file error occurs. The name of the file is passed as the second arg.
v1.0torrent.finished: (LtTorrentHandle)
v1.0
Emitted when a torrent finishes. Porla tries to emit this only once per torrent, meaning that if a torrent has emitted the event and then some data is removed and
torrent.paused: (LtTorrentHandle)
v1.0
Emitted when a torrent is paused.
torrent.finished: (LtInfoHash)
v1.0
Emitted when a torrent is removed. Only the info hash is given.
torrent.resumed: (LtTorrentHandle)
v1.0
Emitted when a torrent is resumed.
torrent.finished: (LtTorrentHandle)
v1.0
Emitted when a torrent has had its storage moved as a result of calling
move_storage.