Hi Clement, rowvalidator is a validator, so it has to have some way to stop execution if something is wrong. I can use chaining, another parameter - or perhaps events are not best for this - some kind of filter or decorator would be better. Anyway, it was only an example.
I think events may be better for extending classes - but I haven't reach that far - yet. ;-) Thanks, On Jan 4, 2:51 pm, Clement Hallet <[email protected]> wrote: > Hi Robert, > > In my mind, events don't replace callbacks, it's just an other way to use > them. > However it's a more "dynamic" way : you can add (one or more) and remove > events callbacks whenever you want. > > I modified your code to use eventshttp://jsfiddle.net/Jxtuk/2/ > > I'm not sure about what "rowvalidator" does, is its return value used inside > your "fun" function ? > If it is, i'm not sure you can use events, since the callbacks returns are > not transmit through"fireEvent" (and it couldn't do that, since it may call > several callbacks, each one having its own return value). > > Hope what i told is clear enough (my first message in that mailing ^^) > > Clément. > > Le 4 janv. 2011 à 14:20, Robert a écrit : > > > > > > > > > hey masters of moo! > > > I am trying to make my code more "mooish". If I understand properly, > > it means using events in exchange of callbacks. > > But I am not sure how to do this and what is the benefit of using > > events? > > > For example I have class for tabular data editing, where I can add > > some validation (pseudocode): > > >http://jsfiddle.net/htZAC/ > > > Does it make sense to change callback for fireEvent? And how should I > > attach it (where)? During creation of object? > > > Thanks, > > btw. is there any other guide to events in moo except for > >http://ryanflorence.com/mootools-events/?
