diff SkeletonKey/HotKey.lua @ 14:82170735e67c

- move co-routine handler to general lib - slightly better handling of pet actions
author Nenue
date Thu, 28 Jul 2016 23:58:53 -0400
parents eeec4a600064
children 73df13211b22
line wrap: on
line diff
--- a/SkeletonKey/HotKey.lua	Thu Jul 28 18:20:32 2016 -0400
+++ b/SkeletonKey/HotKey.lua	Thu Jul 28 23:58:53 2016 -0400
@@ -4,7 +4,7 @@
 -- %file-revision%
 -- Module for fixing actionbar hotkey text
 
-local kb, print = LibStub("LibKraken").register(KeyBinder, 'HotKey')
+local kb, print, wrap = LibStub("LibKraken").register(KeyBinder, 'HotKey')
 local hotkey = {}
 local hotkeyText = {}
 local blizHotKey = {}
@@ -29,36 +29,6 @@
   ["PET_UI_UPDATE"] = {"pet"},
 }
 
-do
-  local tickerQueue = {}
-  local ticker
-  local instant = false
-  hotkey.tick = function()
-
-    if #tickerQueue == 0 then
-      instant = true
-      return
-    else
-      instant = false
-    end
-    local func = tremove(tickerQueue, 1)
-    if func then
-      --print('#', #tickerQueue)
-      func()
-    end
-  end
-  hotkey.wrap = function(f)
-    if not ticker then
-      --print('create ticker')
-      ticker = C_Timer.NewTicker(0, hotkey.tick)
-    end
-    if instant then
-      f()
-    else
-      tinsert(tickerQueue, f)
-    end
-  end
-end
 
 hotkey.wrapEvent = function(event, ...)
   kb:RegisterEvent(event)
@@ -75,7 +45,7 @@
 end
 
 hotkey.ActionButton_Update = function(frame)
-  hotkey.wrap(function()
+  wrap(function()
     local actionType, actionID = GetActionInfo(frame.action)
     hotkey.UpdateSkeletonKeyText(frame, actionType, actionID, HasAction(frame.action))
   end)
@@ -83,7 +53,7 @@
 
 
 hotkey.RegisterFrame = function(frame)
-  --hotkey.wrap(function()
+  --wrap(function()
   --print('ActionBarButtonEventsFrame_RegisterFrame(', frame:GetName(), frame.action, frame:IsVisible(), frame:IsShown())
   --end)
   blizHotKey[frame] = frame.HotKey