diff DependencyLoader/frontend.lua @ 17:f825ccf94a89

fixed an indexing issue in Addon.lua moved most of the code in DependencyLoader.lua to Core.lua, and renamed the former to frontend.lua updated load.xml rearranged stuff in start.lua
author mckenziemc
date Sat, 11 Dec 2010 03:32:04 -0800
parents DependencyLoader/DependencyLoader.lua@a46bf694050c
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DependencyLoader/frontend.lua	Sat Dec 11 03:32:04 2010 -0800
@@ -0,0 +1,51 @@
+--	frontend.lua
+--	Implements the frontend of DependenyLoader
+
+
+local addonName, addonTable = ...
+
+
+local print = addonTable.print
+local debug = addonTable.debug
+
+local Core = addonTable.classes.Core
+
+
+local frontend = LibStub("AceAddon-3.0"):NewAddon(addonName, "AceEvent-3.0")
+addonTable.frontend = frontend
+_G[addonName] = frontend
+
+frontend.addonTable = addonTable
+
+
+function frontend:OnInitialize()
+	debug("Initializing", addonName)
+	self:Enable()
+end
+
+
+function frontend:OnEnable()
+	--	this may get called early so don't rely on 
+	--	it as an indicator for PLAYER_LOGIN
+	
+	if not IsLoggedIn() then
+		self:RegisterEvent("PLAYER_LOGIN")
+	end
+	
+	Core:SetHooks()
+	Core:PrepareAllAddons()
+	
+	print("Enabled", addonName)
+end
+
+
+function frontend:OnDisable()
+	Core:UnhookAll()
+	
+	print("Disabled", addonName)
+end
+
+function frontend:PLAYER_LOGIN(...)
+	Core:ProcessEnableQueue()
+end
+