On Feb 21, 9:13 am, "Edward K. Ream" <[email protected]> wrote:
> 2. Assign the return value of an anonymous function to your namespace
> object:...
> Note the very last line with the closing curly brace and then the
> parentheses ().
Another *visual* pattern in the MooTools sources is that quite a bit
of the "code" is really dictionary syntax. This is easy to miss the
first time around. For example, the argument to the new Class ctor is
a dict, rather than "real" code. For example,
Fx.Tween = new Class({
Extends: Fx.CSS,
initialize: function(element, options){
this.element = this.subject = document.id(element);
this.parent(options);
},
set: function(property, now){
if (arguments.length == 1){
now = property;
property = this.property || this.options.property;
}
this.render(this.element, property, now,
this.options.unit);
return this;
},
start: function(property, from, to){
if (!this.check(property, from, to)) return this;
var args = Array.flatten(arguments);
this.property = this.options.property || args.shift();
var parsed = this.prepare(this.element, this.property,
args);
return this.parent(parsed.from, parsed.to);
}
});
It took me awhile to see this. Before that Aha, the commas were a tad
confusing ;-)
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en.