I haven't tried this kind of thing myself, but one trick that
sometimes works is the concept of delayed execution until end of
execution thread. Essentially, you tell javascript, "execute this as
soon as possible, but only after the current thread finishes". So, if
there's some jquery stuff that happens after your custom "setup" is
called, but you want to tack on extra behavior to happen immediately
after all that plumbing finishes, this approach *might* work.
So, in your "setup" function, on the last line, do this:
setTimeout(function(){ .../*your code to fire the event*/... },0);
See if that works.
On Sep 27, 12:14 pm, "[email protected]"
<[email protected]> wrote:
> I've been playing around with special events lately. I love 'em.
> But...
>
> Say you want to trigger an event the instant that it has been setup,
> from inside the special event code, how would you go about that?
> Considering the code below, I can't see how it is possible:
>
> jQuery.event.special.eventName = {
> setup: function( ) {
> // Do some funky stuff, then...
> jQuery.event.special.frame.handler.call( this,
> eventObject ); // No, because not setup yet
> //return false;
> },
> add: function( ) {
> jQuery.event.special.frame.handler.call( this,
> eventObject ); // Nope, because add happens before setup
> //return false;
> },
> handler: function(event){
> // let jQuery handle the calling of event handlers
> jQuery.event.handle.apply(this, arguments);
> }
>
> };
>
> If this isn't possible, I think another hook would be useful,
> something like 'post', that would allow us to fire events the instant
> they've been registered.
>
> Cheers!
> Stephen.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---