It doesn't look so natural to me. I would prefer this:
$ready().add(function() {
var dragable = $towel($('example-skid-dragable'));
var down = dragable.ui.down();
down.add(dragable.fx.follow());
down.not().add(dragable.phys.skid());
});
The interesting thing here is the "follow" behaviour. The rest is kind
of mystical.
Is ui.down() a mousedown event? down.not(), what is that? mouseup? Why
not directly write mouse up rather than down().not() ?
On 28 mai, 02:21, Barry van Oudtshoorn <[email protected]>
wrote:
> http://toweljs.org/
>
> I saw this at Ajaxian, but not here! It's a library for MooTools that
> focuses on improving event-based code, written by Scato Eggen. It looks
> quite interesting; you can do things like this:
>
> $ready().add(function() {
> var dragable = $('example-skid-dragable');
>
> var down = $towel(dragable).ui.down();
> var follow = $towel(dragable).fx.follow();
> var skid = $towel(dragable).phys.skid();
>
> down.add(follow);
> down.not().add(skid);
>
> });
>
> This will allow you to drag a node around, and have it keep moving
> (decelerating) in the direction of travel for a short while, which is
> pretty cool, especially in so few lines of code.
>
> To be honest, some of the syntax doesn't quite sit with me; for example,
> writing
> var event = $event(request, 'complete')
> just seems, well, backwards -- it's a more procedural, rather than OO,
> style, at least to my mind.
>
> Thoughts?
>
> - Barry van Oudtshoornwww.barryvan.com.au
>
> --
> Not sent from my Apple ?Phone.