[dojo-contributors] Event handling proposal

Eugene Lazutkin eugene at lazutkin.com
Wed Mar 16 20:31:30 EDT 2011

Hash: SHA1


On 03/16/2011 05:33 PM, Kris Zyp wrote:
>> Sounds interesting. It would be nice to see 2-3 real world examples of
>> that. If it works properly, it could be a fantastic way to define
>> app-specific and/or generic/synthetic events.
> I am not sure if by "real world" you mean outside of Dojo, but one of
> the first and foremost applications I hoping for is that we can have all
> our touch and gesture events be extension events.
> define(["dojo/listen", "dojo/gesture"], function(listen, gesture){
>   listen(node, gesture.swipe, callback);
> });
> Note that the way it is written, you can easily use extension event
> functions directly as well:
> gesture.swipe(node, callback);
> Also, I already moved keypress, onmouseenter, onmouseleave out of core
> event listening code and made them extension events. They can be used
> directly like (dojo.connect does this automagically):
> define(["dojo/listen", "dojo/mouse"], function(listen, mouse){
>   listen(node, mouse.enter, callback);
> });

I understood this part. How simple/complex implementation of that
gesture.swipe()? Any realistic examples (in dojo, outside of dojo, and
so on) will do.

>> [snip]
>>> * list provides separation of events and methods. You can have a "start"
>>> method that conditionally triggers a "start" event (mapped to
>>> "onstart"), for example.
>> I started to do something like that in Pulsar and on a surface it looks
>> like a good idea. Again, the devil is in details, in this case in the
>> implementation.
> Yeah, definitely open to your ideas here. I have been wondering if the
> handle returned from connect/listen should have a then() method (but
> would it fire multiple times, or just once?).

I have some ideas on that, but they all raise more questions than they
give answers. I'll try to do a brain dump in near future here. Maybe
somebody can spot something good, or clarify something unanswered.


Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


More information about the dojo-contributors mailing list