diff options
author | Matthew Wild <mwild1@gmail.com> | 2023-11-30 10:07:53 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2023-11-30 10:07:53 +0000 |
commit | f82d804e1d0f87de825262b4f0dbe206218da930 (patch) | |
tree | 9f3d45db4b483f3426d127337e0be0cb0b37ba28 /core | |
parent | 253b2fba90c19cc6758b8d63f409587df688a36e (diff) | |
download | prosody-f82d804e1d0f87de825262b4f0dbe206218da930.tar.gz prosody-f82d804e1d0f87de825262b4f0dbe206218da930.zip |
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.
Diffstat (limited to 'core')
-rw-r--r-- | core/moduleapi.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua index 09776fc1..06aec5c2 100644 --- a/core/moduleapi.lua +++ b/core/moduleapi.lua @@ -781,8 +781,14 @@ function api:may(action, context, peek) 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; |