Hi,

> So, good first try at a bead.   Maybe we don't agree on the scenario.  It
> looked like this bead was considering a scenario where on one call, you
> might set withCredentials=true, and on a subsequent call, you might set
> withCredentials=false,

Yes I said that was a requirement in one of my emails. It also why the function 
accepted it as a parameter rather than just setting it to true.

> in which case you don't want to remove the listeners in postSend.

AFAIKS you do want to remove them, otherwise if you called send again they are 
replaced and there’s a potential for a memory leak.

>  So, by encapsulating this code in a bead, a simpler version can be used for 
> the
> "set it once" crowd, and this more elaborate version could be used by
> someone who does want to change withCredentials in different calls.

So I should create an extra bead CORSWithCredentialsIsTrueBead where is it 
always true? Where user authentication is used there is probably always going 
to be a least one call i.e. the login call before the user is authenticated 
that you don’t want to pass the credentials on. I would guess that having the 
ability to set it would be the more common use case so this extra bead is 
probably not needed.

> Regarding removing listeners, I just noticed that
> ElementWrapper.removeBead does not set the beads strand to null.  

This seems like a bug to me, it should be doing that. That's part of the reason 
I added the remove listeners in the post send handler.

> Right now I think it should.  What do others think?  And then if you want to
> worry about being removed you could check for null and remove listeners,
> but IMO, there should be very few if any scenarios where beads get removed.

While not too common I've run into a couple of times. I just run into another 
earlier today with date formatting.

Thanks,
Justin

Reply via email to