0.1.169: Zeitmesser-Haken in FW:Fire und Dispatch

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016onJCSHLwhs9udhC9ZLzk9
This commit is contained in:
Lacustat
2026-10-29 13:08:32 +01:00
co-authored by Claude Sonnet 5.5
parent 239583652d
commit 1402a910db
2 changed files with 19 additions and 5 deletions
+18 -4
View File
@@ -119,6 +119,8 @@ function FW:Off(event, owner)
end
end
-- Zeitmesser-Haken (setzt das Dev-Modul): FW.ProfEnter(art, ereignis, eintrag) -> Tiefe oder nil, FW.ProfLeave(tiefe, art, ereignis, eintrag).
-- Ohne Dev-Modul kostet das je Aufruf nur eine nil-Pruefung. Die Haken laufen geschuetzt, ein Fehler dort bricht nichts ab.
function FW:Fire(event, ...)
local list = callbacks[event]
if not list then
@@ -128,13 +130,20 @@ function FW:Fire(event, ...)
for i = 1, #list do
snapshot[i] = list[i]
end
local enter, leave = FW.ProfEnter, FW.ProfLeave
for i = 1, #snapshot do
local cb = snapshot[i]
local depth
if enter then
local ok, d = pcall(enter, "fire", event, cb)
if ok then depth = d end
end
if cb.owner then
SafeCall(cb.fn, cb.owner, ...)
else
SafeCall(cb.fn, ...)
end
if depth then pcall(leave, depth, "fire", event, cb) end
end
end
@@ -211,17 +220,22 @@ local function Dispatch(list, ...)
for i = 1, #list do
snapshot[i] = list[i]
end
-- Zeitmesser (Dev-Reiter): FW.HandlerTimer(event, ms, owner), nur wenn gesetzt
local hook, prof = FW.HandlerTimer, _G.debugprofilestop
-- Zeitmesser (Dev-Modul): siehe FW:Fire
local enter, leave = FW.ProfEnter, FW.ProfLeave
local event = curEvent
for i = 1, #snapshot do
local h = snapshot[i]
local t0 = hook and prof and prof()
local depth
if enter then
local ok, d = pcall(enter, "event", event, h)
if ok then depth = d end
end
if h.owner then
SafeCall(h.fn, h.owner, ...)
else
SafeCall(h.fn, ...)
end
if t0 then hook(curEvent, prof() - t0, h.owner) end
if depth then pcall(leave, depth, "event", event, h) end
end
end
+1 -1
View File
@@ -3,7 +3,7 @@
## Notes: Base addon of the Freewood family: data storage, UI kit, export/import and the main window.
## Notes-deDE: Basis-Addon der Freewood-Familie: Datenspeicher, UI-Bausteine, Export/Import und Hauptfenster.
## Author: Lacustat
## Version: 0.1.168
## Version: 0.1.169
## SavedVariables: FreewoodDB
## SavedVariablesPerCharacter: FreewoodCharDB