View Single Post
04/25/22, 07:43 AM   #1
remosito
AddOn Author - Click to view addons
Join Date: Dec 2019
Posts: 30
Order of events fired problem

Howdie all,

I have a problem with Events firing in the wrong order

Code:
EVENT_MANAGER:RegisterForEvent(MyAddon.name, EVENT_CLOSE_BANK, function()   d("closing bank") end)
BACKPACK_MENU_BAR_LAYOUT_FRAGMENT:RegisterCallback("StateChange", function(oldState, newState) if newState == SCENE_SHOWN then d("open inventory")  end end)
If I am at banker. and close it then open inventory with i I get the expected

closing bank
open inventory

but if I am at bank and hit i directly I get:

open inventory
closing bank

open inventory gets fired before closign bank...This screws with my add/remove of Keybind bar button(groups) that are in those two functions as well (cut that to make it easier to parse)

To check it's not accross the board. I tested LibFilters Event firing of visible/hidden callback functions I registered there. And those fire in expected order in both cases...

Worst come worst. I can just piggy pack my keybind button stuff onto those libfilter callbacks.

But before I do so and need to make libfilters a required dependency instead of an optional one. I thought I 'd ask if I maybe just picked really unfortunate events to register callbacks to. And there would be better ones that "obey" order....

thanks a bunch in advance
  Reply With Quote