Software /
code /
prosody
Changeset
13360:6037b7a2131c
moduleapi: Rename :once() to :on_ready() for clarity
'Once' is ambiguous - once per what?
on_ready() executes its parameter when the module is loaded *and* the server
has finished starting.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 30 Nov 2023 10:07:53 +0000 |
parents | 13359:1796370091d4 |
children | 13361:e20949a10118 |
files | core/moduleapi.lua |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/core/moduleapi.lua Thu Nov 30 09:47:00 2023 +0000 +++ b/core/moduleapi.lua Thu Nov 30 10:07:53 2023 +0000 @@ -781,8 +781,14 @@ end -- Execute a function, once, but only after startup is complete -function api:once(f) --luacheck: ignore 212/self +function api:on_ready(f) --luacheck: ignore 212/self return prosody.started:next(f); end +-- COMPAT w/post 0.12 trunk +function api:once(f) + self:log("warn", "This module uses deprecated module:once() - switch to module:on_ready() or (better) expose function module.ready()"); + return self:on_ready(f); +end + return api;