Aaron,
What if data is an array ? fireEvent will think it's getting an array of
arguments. This is the case of Twitter. The json response looks like this:
[{ aaron: 'newton', valerio: 'propietti' }]
If we pass that to fireEvent directly, the callback gets { aaron: 'newton',
valerio: 'propietti' }, which is not the actual response. That's why alexg's
*data = data[0]* was not working, as *data* was already the object and not
the wrapping array.
On Wed, Mar 11, 2009 at 1:32 PM, Aaron Newton <[email protected]> wrote:
>
> There is absolutely no difference between these two lines:
>
> this.fireEvent('complete', data).fireEvent('success', data).callChain
> ();
> this.fireEvent('complete', [data]).fireEvent('success',
> [data]).callChain();
>
> They both do the exact same thing. fireEvent can take as its second
> argument a single item or an array of them. A single item is passed as
> the argument, while an array is applied for several arguments.
>
> On Mar 11, 5:58 am, alexg <[email protected]> wrote:
> > Fantastic, thank you very much for this Guillermo,
> >
> > I would have filed this in the Lighthouse, but was convinced it was me
> > doing something wrong!
> >
> > Alex
>
--
Guillermo Rauch
http://devthought.com