ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   RegisterForEvent vs. RegisterForUpdate (https://www.esoui.com/forums/showthread.php?t=906)

wilson0x4d 04/14/14 08:24 PM

RegisterForEvent vs. RegisterForUpdate
 
/zgoo EVENT_MANAGER

I see there are RegisterForEvent and RegisterForUpdate methods exposed by EVENT_MANAGER.

RegisterForEvent is obvious to me, but what is the intended use of RegisterForUpdate?

Dio 04/14/14 10:22 PM

Wow, nice find. It allows you to bind an update handler to your addon, 2nd argument is how often to poll in milliseconds.

e.g.

Code:

EVENT_MANAGER:RegisterForUpdate(self.name, 2000, function(millisecondsRunning)
    d("Called every 2 seconds!")
end)


wilson0x4d 04/15/14 04:41 AM

Well now I'm curious.. how were you able to resolve the input parameters? This has been one of my larger problems in understanding the API calls.

Dio 04/15/14 11:09 AM

Quote:

Originally Posted by wilson0x4d (Post 4399)
Well now I'm curious.. how were you able to resolve the input parameters? This has been one of my larger problems in understanding the API calls.

Lucky guess. I called it with two parameters, name and callback, and then it gave some error about invalid argument and the 2nd argument "interval" needing to be an integer. I deduced that the interval was how often the function is polled in milliseconds.

Sideshow 04/15/14 11:16 AM

That's a valid description of the current API: guesswork :D


All times are GMT -6. The time now is 09:54 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI