[dojo-contributors] Event handling proposal

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


-----BEGIN PGP SIGNED MESSAGE-----
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2BVlsACgkQY214tZwSfCuE9ACgj3WZbZ8dZvczP0vEtgwx7rw7
Z8wAoIqnfLMMuSw7E4fnkQxRfytx4yUT
=fA33
-----END PGP SIGNATURE-----


More information about the dojo-contributors mailing list