Skip to content

Commit e9a0c42

Browse files
committed
Minor code cleanup
1 parent 4596a06 commit e9a0c42

1 file changed

Lines changed: 27 additions & 28 deletions

File tree

AddonProfiler.lua

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,31 @@ local CLOSE_ON_ESC_ALWAYS = 'always';
9999
local CLOSE_ON_ESC_NEVER = 'never';
100100
local CLOSE_ON_ESC_IN_COMBAT = 'inCombat';
101101

102+
-- these values should not be changed, they're persisted in SVs to remember whether they're toggled on or off
103+
local HEADER_IDS = {
104+
addonTitle = "addonTitle",
105+
encounterAvgMs = "encounterAvgMs",
106+
overallEncounterAvgPercent = "overallEncounterAvgPercent",
107+
peakTimeMs = "peakTimeMs",
108+
overallPeakTimePercent = "overallPeakTimePercent",
109+
recentMs = "recentMs",
110+
overallRecentPercent = "overallRecentPercent",
111+
averageMs = "averageMs",
112+
totalMs = "totalMs",
113+
overallTotalPercent = "overallTotalPercent",
114+
applicationTotalPercent = "applicationTotalPercent",
115+
["overCount-1"] = "overCount-1",
116+
["overCount-5"] = "overCount-5",
117+
["overCount-10"] = "overCount-10",
118+
["overCount-50"] = "overCount-50",
119+
["overCount-100"] = "overCount-100",
120+
["overCount-500"] = "overCount-500",
121+
["overCount-1000"] = "overCount-1000",
122+
spikeSumMs = "spikeSumMs",
123+
};
124+
local ORDER_ASC = 1;
125+
local ORDER_DESC = -1;
126+
102127
--- @type table<string, NAP_AddonInfo>
103128
NAP.addons = {};
104129
--- @type table<string, boolean> # list of addon names
@@ -107,7 +132,7 @@ NAP.loadedAddons = {};
107132
local ADDON_PROFILING_DISABLED_WARNING =
108133
"Addon Profling is disabled, perhaps you installed a weakaura similar to wago.io/DisableCPUProfiling. Remove it to use this addon."
109134
.. "\n"
110-
.. ("Click %shere%s to enable addon profiling again."):format("|cff71d5ff|Haddon:NumyAddonProfiler:addonProfilerEnabled|h[", "]|h|r")
135+
.. ("Click %shere%s to enable addon profiling again."):format("|cff71d5ff|Haddon:NumyAddonProfiler:addonProfilerEnabled|h[", "]|h|r");
111136

112137
--- Note: NAP:Init() is called at the end of the script body, BEFORE the addon_loaded event
113138
function NAP:Init()
@@ -290,29 +315,6 @@ function NAP:SlashCommand(message)
290315
end
291316
end
292317

293-
-- these values should not be changed, they're persistent in SVs to remember whether they're toggled on or off
294-
local HEADER_IDS = {
295-
addonTitle = "addonTitle",
296-
encounterAvgMs = "encounterAvgMs",
297-
overallEncounterAvgPercent = "overallEncounterAvgPercent",
298-
peakTimeMs = "peakTimeMs",
299-
overallPeakTimePercent = "overallPeakTimePercent",
300-
recentMs = "recentMs",
301-
overallRecentPercent = "overallRecentPercent",
302-
averageMs = "averageMs",
303-
totalMs = "totalMs",
304-
overallTotalPercent = "overallTotalPercent",
305-
applicationTotalPercent = "applicationTotalPercent",
306-
["overCount-1"] = "overCount-1",
307-
["overCount-5"] = "overCount-5",
308-
["overCount-10"] = "overCount-10",
309-
["overCount-50"] = "overCount-50",
310-
["overCount-100"] = "overCount-100",
311-
["overCount-500"] = "overCount-500",
312-
["overCount-1000"] = "overCount-1000",
313-
spikeSumMs = "spikeSumMs",
314-
}
315-
316318
function NAP:InitDB()
317319
if not AddonProfilerDB then
318320
AddonProfilerDB = {};
@@ -358,7 +360,7 @@ function NAP:InitDB()
358360
historySelectionType = self.currentHistorySelection.type,
359361
historySelectionTimeRange = self.currentHistorySelection.timeRange,
360362
sortColumn = HEADER_IDS.averageMs,
361-
sortOrder = -1,
363+
sortOrder = ORDER_DESC,
362364
};
363365
for key, value in pairs(defaults) do
364366
if self.db[key] == nil then
@@ -1054,9 +1056,6 @@ function NAP:InitUI()
10541056
self.dataProvider = nil;
10551057
self.curMatch = ".+"
10561058

1057-
local ORDER_ASC = 1;
1058-
local ORDER_DESC = -1;
1059-
10601059
local msText = "|cff808080ms|r";
10611060
local xText = "|cff808080x|r";
10621061
local kbText = "|cff808080KB|r";

0 commit comments

Comments
 (0)