jQuery.fn.triggerAsync  function     

plugin: jquery/event/default

Triggers an event and calls success when the event has finished propagating through the DOM and preventDefault is not called.

$('#panel').triggerAsync('show', function(){
  $('#panel').show();
})

You can also provide a callback that gets called if preventDefault was called on the event:

$('#panel').triggerAsync('show', function(){
  $('#panel').show();
},function(){
  $('#other').addClass('error');
})

triggerAsync is designed to work with the jquery.event.pause plugin although it is defined in jquery/event/default

API

$.fn.triggerAsync(type, data, success, prevented, success(event), prevented(event)) -> undefined
{String}

The type of event

{Object}

The data for the event

{}
{}
{Function}

a callback function

{Function}

called if preventDefault is called on the

{undefined}
© Jupiter IT - JavaScriptMVC Training and Support