Le lundi 7 décembre 2009 12:46, T.J. Crowder a écrit :
> Worth reading up on the `arguments` variable in the spec[1] (warning,
> multi-meg PDF). Also check out Function#apply, which is probably what
> you're looking for:
It works fine! Here is the code I now use:
var Signal = Class.create({
initialize: function () {
this._slots = new Array();
},
emit: function() {
for (i = 0; i < this._slots.length; i++) {
try {
this._slots[i].apply(this, arguments);
}
catch (e) {
}
}
},
connect: function(slot) {
if (!this._slots.include(slot)) {
this._slots.push(slot);
}
},
disconnect: function(slot) {
if (this._slots.include(slot)) {
this._slots.splice(this._slots.indexOf(slot, 1));
}
},
disconnectAll: function() {
this._slots = new Array();
},
});
Thanks for your help :o)
--
Frédéric
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en.