Hello everyone, as you may already noticed from the subject of this post I''m new to javascript and to be honest if I can choose I''ll certainly don''t do it but once javascript is the only way to make web browsers to behave, well one had to get dirty on it. Said that, I found Prototype (and Scriptaculous) very nice frameworks. They have a lot of sense and add a lot of value to the web developing experience. So I glad you have made this and I can participate in this group. For an application I''m doing with Seaside (which uses dinamically Scriptaculous) I need some events that should trigger scripts evaluations to be managed in javascript. In the .js libraries I''m developing to help the rest (almost all UI related) of the application I want a javascript object that allow me to add the hooks and their respective actionsScripts to be evaluated that my the Seaside application setup dinamically so I need a collection (#add #remove and such) to make it flexible enough but I did''t find Collection in Prototype. Paradoxically I''ve found a pretty complete iterator (the Enumerable). I''ve see with Firebug that making initialize(){ mouseOutListeners = new Collection; } gives me an error because Collection is not defined. I''ll really appreciate any pointer on this, thanks Sebastian --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You need to write that as... mouseOutListeners = new Collection(); I believe. Add the (). On 5/26/07, Sebastian Sastre <ssastre-luH6fFXSdSWH0oMTQjrRWA@public.gmane.org> wrote:> > Hello everyone, > > as you may already noticed from the subject of this post I''m new to > javascript and to be honest if I can choose I''ll certainly don''t do it > but once javascript is the only way to make web browsers to behave, > well one had to get dirty on it. > > Said that, I found Prototype (and Scriptaculous) very nice > frameworks. They have a lot of sense and add a lot of value to the web > developing experience. So I glad you have made this and I can > participate in this group. > > For an application I''m doing with Seaside (which uses dinamically > Scriptaculous) I need some events that should trigger scripts > evaluations to be managed in javascript. In the .js libraries I''m > developing to help the rest (almost all UI related) of the application > I want a javascript object that allow me to add the hooks and their > respective actionsScripts to be evaluated that my the Seaside > application setup dinamically so I need a collection (#add #remove and > such) to make it flexible enough but I did''t find Collection in > Prototype. Paradoxically I''ve found a pretty complete iterator (the > Enumerable). > > I''ve see with Firebug that making > > initialize(){ > mouseOutListeners = new Collection; > } > > gives me an error because Collection is not defined. > > I''ll really appreciate any pointer on this, > > thanks > > Sebastian > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Well seems to be that is not enough. Don''t matters I put a) var listeners = new Collection; b) var listeners = new Collection(); c) listeners = new Collection; d) listeners = new Collection(); in the initialize function Firebug is telling me that Collection is not defined. Collection is a standard class in javascript right? or one should include something or what? thanks, Sebastian On 26 maio, 22:28, "Andrew Kaspick" <akasp...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You need to write that as... > > mouseOutListeners = new Collection(); > > I believe. Add the (). > > On 5/26/07, Sebastian Sastre <ssas...-luH6fFXSdSWH0oMTQjrRWA@public.gmane.org> wrote: > > > > > Hello everyone, > > > as you may already noticed from the subject of this post I''m new to > > javascript and to be honest if I can choose I''ll certainly don''t do it > > but once javascript is the only way to make web browsers to behave, > > well one had to get dirty on it. > > > Said that, I found Prototype (and Scriptaculous) very nice > > frameworks. They have a lot of sense and add a lot of value to the web > > developing experience. So I glad you have made this and I can > > participate in this group. > > > For an application I''m doing with Seaside (which uses dinamically > > Scriptaculous) I need some events that should trigger scripts > > evaluations to be managed in javascript. In the .js libraries I''m > > developing to help the rest (almost all UI related) of the application > > I want a javascript object that allow me to add the hooks and their > > respective actionsScripts to be evaluated that my the Seaside > > application setup dinamically so I need a collection (#add #remove and > > such) to make it flexible enough but I did''t find Collection in > > Prototype. Paradoxically I''ve found a pretty complete iterator (the > > Enumerable). > > > I''ve see with Firebug that making > > > initialize(){ > > mouseOutListeners = new Collection; > > } > > > gives me an error because Collection is not defined. > > > I''ll really appreciate any pointer on this, > > > thanks > > > Sebastian--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On May 28, 6:02 am, Sebastian Sastre <ssas...-luH6fFXSdSWH0oMTQjrRWA@public.gmane.org> wrote:> Well seems to be that is not enough. Don''t matters I put > a) var listeners = new Collection; > b) var listeners = new Collection(); > c) listeners = new Collection; > d) listeners = new Collection(); > > in the initialize function Firebug is telling me that Collection is > not defined.If you want to see if Collection (or any other identifier) is defined: alert(typeof Collection);> Collection is a standard class in javascript right? or one should > include something or what?Javascript doesn''t have classes, it has objects. There is no built-in Collection object in ECMA script, though the DOM does have an HTMLCollection based on a NodeList - but I don''t think that''s what you''re after. The word "Collection" doesn''t appear anywhere in Prototype.js or Scriptaculous.js. You may be after what Prototype calls a hash, look at $H(): <URL: http://www.prototypejs.org/api/hash > -- Rob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On May 27, 2:48 am, Sebastian Sastre <ssas...-luH6fFXSdSWH0oMTQjrRWA@public.gmane.org> wrote:> Hello everyone, > > as you may already noticed from the subject of this post I''m new to > javascript and to be honest if I can choose I''ll certainly don''t do it > but once javascript is the only way to make web browsers to behave, > well one had to get dirty on it. > > Said that, I found Prototype (and Scriptaculous) very nice > frameworks. They have a lot of sense and add a lot of value to the web > developing experience. So I glad you have made this and I can > participate in this group. >In javascript you can use Array and the method push that add to the end, pop that remove from the end, shift that return and remove the first. Prototype extends Array with Enumerable. You have a lot of methods there! Giuan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Oh regardeless of it''s name that''s a Dictionary, a set of keys and it''s values. Excellent this is what I was searching for, thanks Rob! cheers, Sebastian On 27 maio, 17:34, RobG <r...-AFFH1GffN5hPR4JQBCEnsQ@public.gmane.org> wrote:> On May 28, 6:02 am, Sebastian Sastre <ssas...-luH6fFXSdSWH0oMTQjrRWA@public.gmane.org> wrote: > > > Well seems to be that is not enough. Don''t matters I put > > a) var listeners = new Collection; > > b) var listeners = new Collection(); > > c) listeners = new Collection; > > d) listeners = new Collection(); > > > in the initialize function Firebug is telling me that Collection is > > not defined. > > If you want to see if Collection (or any other identifier) is defined: > > alert(typeof Collection); > > > Collection is a standard class in javascript right? or one should > > include something or what? > > Javascript doesn''t have classes, it has objects. There is no built-in > Collection object in ECMA script, though the DOM does have an > HTMLCollection based on a NodeList - but I don''t think that''s what > you''re after. > > The word "Collection" doesn''t appear anywhere in Prototype.js or > Scriptaculous.js. You may be after what Prototype calls a hash, look > at $H(): > > <URL:http://www.prototypejs.org/api/hash> > > -- > Rob--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ah! thanks Giuan, I though JS arrays can''t grow. In fact a Dictionary is more what I was looking for and Hash seems to have the intention to be a Dictionary (at least in structure) but I''ve saw that it has a lack of #select, #detect, etc methods so I''m reconsidering using a Hash and try the Array as you said. In a quick view of Prototype code I saw that Hash don''t even seems to be a class so I''m a little confused about that. Anyway.. I will try with anArray because Enumerator provides it of a pretty decent behavior. thanks a lot, Sebastian On May 27, 6:48 pm, giuan <giua...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On May 27, 2:48 am, Sebastian Sastre <ssas...-luH6fFXSdSWH0oMTQjrRWA@public.gmane.org> wrote: > > > Hello everyone, > > > as you may already noticed from the subject of this post I''m new to > > javascript and to be honest if I can choose I''ll certainly don''t do it > > but once javascript is the only way to make web browsers to behave, > > well one had to get dirty on it. > > > Said that, I found Prototype (and Scriptaculous) very nice > > frameworks. They have a lot of sense and add a lot of value to the web > > developing experience. So I glad you have made this and I can > > participate in this group. > > In javascript you can use Array and the method push that add to the > end, pop that remove from the end, shift that return and remove the > first. Prototype extends Array with Enumerable. You have a lot of > methods there! > > Giuan--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Wrong Hash is an Enumarable too line 815 Object.extend(Hash.prototype, Enumerable); Seb On May 28, 2007, at 6:31 PM, Sebastian Sastre wrote:> > Ah! thanks Giuan, I though JS arrays can''t grow. In fact a Dictionary > is more what I was looking for and Hash seems to have the intention to > be a Dictionary (at least in structure) but I''ve saw that it has a > lack of #select, #detect, etc methods so I''m reconsidering using a > Hash and try the Array as you said. In a quick view of Prototype code > I saw that Hash don''t even seems to be a class so I''m a little > confused about that. Anyway.. I will try with anArray because > Enumerator provides it of a pretty decent behavior. > > thanks a lot, > > Sebastian > > On May 27, 6:48 pm, giuan <giua...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> On May 27, 2:48 am, Sebastian Sastre <ssas...-luH6fFXSdSWH0oMTQjrRWA@public.gmane.org> wrote: >> >>> Hello everyone, >> >>> as you may already noticed from the subject of this post I''m >>> new to >>> javascript and to be honest if I can choose I''ll certainly don''t >>> do it >>> but once javascript is the only way to make web browsers to behave, >>> well one had to get dirty on it. >> >>> Said that, I found Prototype (and Scriptaculous) very nice >>> frameworks. They have a lot of sense and add a lot of value to >>> the web >>> developing experience. So I glad you have made this and I can >>> participate in this group. >> >> In javascript you can use Array and the method push that add to the >> end, pop that remove from the end, shift that return and remove the >> first. Prototype extends Array with Enumerable. You have a lot of >> methods there! >> >> Giuan > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Sébastien, Good to know. I''ve already implemented with arrays and it seems to be enough by now, but thanks for the clarification because I''ll probably need dictionaries in the future. Questions: 1. how add/remove behave in a Hash object? I mean, one should send to add/remove pairs in it right? 2. I''m about to execute the code I''m developing now for first time and I expecting that Hash stores any object in the value but I also wanted to know if Hash keys can be any object or they should be strings and numbers only? Thanks, Sebastian On May 28, 1:48 pm, Sébastien Gruhier <sgruh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Wrong Hash is an Enumarable too > > line 815 Object.extend(Hash.prototype, Enumerable); > > Seb > > On May 28, 2007, at 6:31 PM, Sebastian Sastre wrote: > > > > > Ah! thanks Giuan, I though JS arrays can''t grow. In fact a Dictionary > > is more what I was looking for and Hash seems to have the intention to > > be a Dictionary (at least in structure) but I''ve saw that it has a > > lack of #select, #detect, etc methods so I''m reconsidering using a > > Hash and try the Array as you said. In a quick view of Prototype code > > I saw that Hash don''t even seems to be a class so I''m a little > > confused about that. Anyway.. I will try with anArray because > > Enumerator provides it of a pretty decent behavior. > > > thanks a lot, > > > Sebastian > > > On May 27, 6:48 pm, giuan <giua...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> On May 27, 2:48 am, Sebastian Sastre <ssas...-luH6fFXSdSWH0oMTQjrRWA@public.gmane.org> wrote: > > >>> Hello everyone, > > >>> as you may already noticed from the subject of this post I''m > >>> new to > >>> javascript and to be honest if I can choose I''ll certainly don''t > >>> do it > >>> but once javascript is the only way to make web browsers to behave, > >>> well one had to get dirty on it. > > >>> Said that, I found Prototype (and Scriptaculous) very nice > >>> frameworks. They have a lot of sense and add a lot of value to > >>> the web > >>> developing experience. So I glad you have made this and I can > >>> participate in this group. > > >> In javascript you can use Array and the method push that add to the > >> end, pop that remove from the end, shift that return and remove the > >> first. Prototype extends Array with Enumerable. You have a lot of > >> methods there! > > >> Giuan--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---