Thread Tools Display Modes
04/14/14, 08:24 PM   #1
wilson0x4d
Premium Member
 
wilson0x4d's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 6
Question 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?
  Reply With Quote
04/14/14, 10:22 PM   #2
Dio
 
Dio's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 29
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)
  Reply With Quote
04/15/14, 04:41 AM   #3
wilson0x4d
Premium Member
 
wilson0x4d's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 6
Question

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.
  Reply With Quote
04/15/14, 11:09 AM   #4
Dio
 
Dio's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 29
Originally Posted by wilson0x4d View Post
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.
  Reply With Quote
04/15/14, 11:16 AM   #5
Sideshow
 
Sideshow's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 36
That's a valid description of the current API: guesswork
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » RegisterForEvent vs. RegisterForUpdate


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off