Comparison

core/moduleapi.lua @ 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
parent 13309:113ce2ac73a2
child 13368:80a1ce9974e5
comparison
equal deleted inserted replaced
13359:1796370091d4 13360:6037b7a2131c
779 return permit; 779 return permit;
780 end 780 end
781 end 781 end
782 782
783 -- Execute a function, once, but only after startup is complete 783 -- Execute a function, once, but only after startup is complete
784 function api:once(f) --luacheck: ignore 212/self 784 function api:on_ready(f) --luacheck: ignore 212/self
785 return prosody.started:next(f); 785 return prosody.started:next(f);
786 end 786 end
787 787
788 -- COMPAT w/post 0.12 trunk
789 function api:once(f)
790 self:log("warn", "This module uses deprecated module:once() - switch to module:on_ready() or (better) expose function module.ready()");
791 return self:on_ready(f);
792 end
793
788 return api; 794 return api;