[dojo-contributors] Event handling proposal

Evan Huang evanhuangwei at gmail.com
Tue Mar 22 12:43:05 EDT 2011

Hi Eugene/Kris,

I just post an initial v 0.2 touch & gesture patch(still in-progress)
which was based on the 1st version of event.diff, though it mostly
likely won't run well with the new event.diff, this might still help
the discussion a bit:
- http://bugs.dojotoolkit.org/attachment/ticket/12176/touch0.2.patch

Please let me know if anything I missed when following the new listener/aop way.

The new events refactoring provides very nice extendability, I was
able to add in dojo.touch/gesture based on the new listener/aop
mechanism without any difficulties, haven't tried out gesture.swipe(),
but based on the experimented gesture.tap() in the patch, it should
also be smooth to implement. But I'm still a bit concerning the new
semantic changes to dojo.connect(n, dojo.touch.tap, callback) / or
dojo.touch.tap(n, callback), especially the 2nd may bring confusions?

p.s - might not be able to respond in time recently...


- Evan

On Thu, Mar 17, 2011 at 8:31 AM, Eugene Lazutkin <eugene at lazutkin.com> wrote:
> Hash: SHA1
> Inline.
> 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.
> Cheers,
> Eugene
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> iEYEARECAAYFAk2BVlsACgkQY214tZwSfCuE9ACgj3WZbZ8dZvczP0vEtgwx7rw7
> Z8wAoIqnfLMMuSw7E4fnkQxRfytx4yUT
> =fA33
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at mail.dojotoolkit.org
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors

More information about the dojo-contributors mailing list