On Tue, Nov 29, 2011 at 5:05 PM, Lex Berezhny <[email protected]> wrote:
> The EventController is significantly more complicated.
no it's not!
> And I don't
> really gain anything at all from the complexity. Mine is very simple
> and does exactly what I want with very minimal setup.
the setup on use of Handler is actually less than what you would be
forced to use in the code that you've written.
from pyjamas.EventController import Handler
h = Handler("login")
h.addListener(login_callback_object)
# trigger:
h.onLoginEvent()
class LoginCallbackObject:
def onLoginEvent(self, sender):
print "called", sender
whereas with what you have, it has to be:
h = Handler()
h.addEventType("login")
h.subscribe("login", login_callback_object)
# trigger:
h.notify("login", None) # forced requirement to have data not *args
... you see the difference? in the next N months, i guarantee that
you'll go "hmm, i remember that event code, i could use it here but
whoops, i now have to make it quotes complicated quotes because oh
dear it doesn't take enough arguments or it's getting quotes
complicated quotes because i have to call notify with so many
different string arguments because it's being used for so many
different purposes"
one to watch out for.
l.