Hello,
that''s my first post here, and for info i''m french. ( I hope
it won''t
oblige you to ignore my request !! ;) )
As the Object of this messages says, I''ll disucuss about
implementation of Event.exists by using Event.responders.
Some code :
Object.extend( Event.prototype, {
//works fine without anonymous or binded functions
exists : function( observer ) {
for( var i = 0, len = this.observers.length; i < len; ++i ) {
var ref = this.observers[i];
if( ref.compare( observer ) )
return true;
}
return false;
}
} );
Object.extend( Array.prototype, {
compare : function( arr ) {
if( ! ( arr instanceof Array ) )
return false;
if( this.length != arr.length )
return false;
for( var a = 0; a < this.length; ++a ) {
if( ( this[a] instanceof Array ) && ( arr[a] instanceof
Array ) ) {
if( ! ( this[a].compare( arr[a] ) ) )
return false;
}
var ref = this[a];
var comp = arr[a];
if( ref !== comp )
return false;
}
return true;
}
} );
Array.compare compares recursively the passed array with the this
scope. It wasn''t implemented so did I.
What I wolud like is some help to make Event.exists fonctional.
Bye ( and sorry for my english ).
Florian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---