comparison Libs/AceAddon-3.0/AceAddon-3.0.lua @ 18:a0dcdcaec1ea v7.3.0.018

- toc update. - libs update.
author Tercio
date Tue, 17 Oct 2017 10:02:01 -0200
parents ce416064d8a1
children
comparison
equal deleted inserted replaced
17:da84a5064a5a 18:a0dcdcaec1ea
26 -- -- You would probably only use an OnDisable if you want to 26 -- -- You would probably only use an OnDisable if you want to
27 -- -- build a "standby" mode, or be able to toggle modules on/off. 27 -- -- build a "standby" mode, or be able to toggle modules on/off.
28 -- end 28 -- end
29 -- @class file 29 -- @class file
30 -- @name AceAddon-3.0.lua 30 -- @name AceAddon-3.0.lua
31 -- @release $Id: AceAddon-3.0.lua 1036 2011-08-16 22:45:05Z nevcairiel $ 31 -- @release $Id: AceAddon-3.0.lua 1084 2013-04-27 20:14:11Z nevcairiel $
32 32
33 local MAJOR, MINOR = "AceAddon-3.0", 11 33 local MAJOR, MINOR = "AceAddon-3.0", 12
34 local AceAddon, oldminor = LibStub:NewLibrary(MAJOR, MINOR) 34 local AceAddon, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
35 35
36 if not AceAddon then return end -- No Upgrade needed. 36 if not AceAddon then return end -- No Upgrade needed.
37 37
38 AceAddon.frame = AceAddon.frame or CreateFrame("Frame", "AceAddon30Frame") -- Our very own frame 38 AceAddon.frame = AceAddon.frame or CreateFrame("Frame", "AceAddon30Frame") -- Our very own frame
105 -- local functions that will be implemented further down 105 -- local functions that will be implemented further down
106 local Enable, Disable, EnableModule, DisableModule, Embed, NewModule, GetModule, GetName, SetDefaultModuleState, SetDefaultModuleLibraries, SetEnabledState, SetDefaultModulePrototype 106 local Enable, Disable, EnableModule, DisableModule, Embed, NewModule, GetModule, GetName, SetDefaultModuleState, SetDefaultModuleLibraries, SetEnabledState, SetDefaultModulePrototype
107 107
108 -- used in the addon metatable 108 -- used in the addon metatable
109 local function addontostring( self ) return self.name end 109 local function addontostring( self ) return self.name end
110
111 -- Check if the addon is queued for initialization
112 local function queuedForInitialization(addon)
113 for i = 1, #AceAddon.initializequeue do
114 if AceAddon.initializequeue[i] == addon then
115 return true
116 end
117 end
118 return false
119 end
110 120
111 --- Create a new AceAddon-3.0 addon. 121 --- Create a new AceAddon-3.0 addon.
112 -- Any libraries you specified will be embeded, and the addon will be scheduled for 122 -- Any libraries you specified will be embeded, and the addon will be scheduled for
113 -- its OnInitialize and OnEnable callbacks. 123 -- its OnInitialize and OnEnable callbacks.
114 -- The final addon object, with all libraries embeded, will be returned. 124 -- The final addon object, with all libraries embeded, will be returned.
312 -- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon") 322 -- MyAddon = LibStub("AceAddon-3.0"):GetAddon("MyAddon")
313 -- MyModule = MyAddon:GetModule("MyModule") 323 -- MyModule = MyAddon:GetModule("MyModule")
314 -- MyModule:Enable() 324 -- MyModule:Enable()
315 function Enable(self) 325 function Enable(self)
316 self:SetEnabledState(true) 326 self:SetEnabledState(true)
317 return AceAddon:EnableAddon(self) 327
328 -- nevcairiel 2013-04-27: don't enable an addon/module if its queued for init still
329 -- it'll be enabled after the init process
330 if not queuedForInitialization(self) then
331 return AceAddon:EnableAddon(self)
332 end
318 end 333 end
319 334
320 --- Disables the Addon, if possible, return true or false depending on success. 335 --- Disables the Addon, if possible, return true or false depending on success.
321 -- This internally calls AceAddon:DisableAddon(), thus dispatching a OnDisable callback 336 -- This internally calls AceAddon:DisableAddon(), thus dispatching a OnDisable callback
322 -- and disabling all modules of the addon.\\ 337 -- and disabling all modules of the addon.\\