I’m playing around with implementing an event pool pattern in my javascript, similar to what is described here: http://www.michaelhamrah.com/blog/2008/12/event-pooling-with-jquery-using-bind-and-trigger-managing-complex-javascript/
I need to be able to set the context of the event’s closure(s) when they are triggered, rather than when they are bound. Is there some method of combining $.trigger and $.proxy to do this?
I’m just going to put this here for anyone else googling, but its not the actual answer to the whole binding at trigger time part.
This is a workaround solution that wraps the binding function to set its context according to an argument supplied at trigger time. It’s no good if you want to pass args at trigger time though.