Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Dispatch an event vs callback — Gideros Forum

Dispatch an event vs callback

CarolineCaroline Guru
edited February 2012 in Plugins
I'm a little confused as to when to dispatch an event, and when just to do a direct callback.

It makes sense to me to dispatch events in games, when many objects may be listening, but with UIKit items, such as a button tap, then very likely only that one button is listening. Or if you have a delegate callback from selecting a UITableView row, it would make sense to me to make that a callback rather than dispatching an event.

In Objective C, I would be doing a one function call on pressing a button. I think the NSNotification is the equivalent of dispatching an event, and I try only to use very few in an app, as they are fairly hard to keep track of.

This means that if I were to have a UIButton then I wouldn't have to inherit from GEventDispatcherProxy. Would I? I could just do the onButtonPress function in the plugin, which directly calls a Lua function.

Am I over-thinking this? Does it matter?

Likes: ar2rsawseen

+1 -1 (+1 / -0 )Share on Facebook

Comments

Sign In or Register to comment.