Event that identifies shooting another event?

Asked

Viewed 31 times

0

I have a jQuery event that comes from a framework, and I need to trigger a specific event at the end of the shooting of this event that is not foreseen.

It would be something like this:

Framework event

var evento = function() {
    $(document).on('click','.btn',function(){
       //Faz algo
       return response;
    })
}

Event that identifies the previous shot, the shot is hypothetical, but what it will do is just that:

$(document).on('eventoFoiDisparado','evento',function(){
    $('.fiscal-target-close').trigger('click');
})

I know I can use the eventListener, but I’ve never needed it before, and I’m not being able to apply it because the event of the framework in question is a universal event, that is, it’s going to go off in many different locations, and I need it in a specific situation.

NOTE: This framework event is inside a function started with .init.

OBS2: The Event I want to shoot when firing the other event is detached to any other function, it’s just to fix a response display problem.

  • Your question is not very clear to me, I could not understand exactly what you want. You said that the event is not foreseen in the framework, but put a code snippet from the framework event. Then he exemplified what you want to do, capturing the triggered event. What is your difficulty then?

  • I have difficulty understanding how to identify the shooting of an event with another event, or how to use the eventListener to identify this. PS: the framework is proper, if it is not very feasible to do this, I also want to know to modify the framework.

  • Simplistically: By clicking a button, and finishing what the click event did (this is done by the framework), do something else that wasn’t in the original event (it would be the single event that I need).

  • If you can modify the framework and at the end of the event in question, issue a new event indicating that you have finished that execution, it would be the best way. Just like this to ensure that there is a sequence in the execution. Other forms might not be executed in the order you want.

  • @Pedrosouza thought about it too, is that this will really only be shot once in a place that is rarely used, but I think it looks more beautiful not to gambiarra even kk

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.