Jquery callback function
<p>I have a problem in creating a callback function. First, as far as I can understand, a callback acts like  a parametr which triggers when all the action in its "parent" function has finished. For example: </p>

<pre><code>$('p').hide('slow', function() {
    $(this).show('slow');
});
</code></pre>

<p>At first <code>&lt;p&gt;</code> is hidden, and only afterwards it shows again.</p>

<p>How can I apply such callback in a random plugin?</p>

<p>For example a plugin looks like this:</p>

<pre><code> $.fn.myPlugin = function(settings) { 
   return this.each(function() {
    settings = $.extend({ onShow: null }, settings);
    $(this).hide('slow');  /*This action should happen first (First action)*/
    if ( $.isFunction( settings.onShow ) ) 
     settings.onShow.call(this);/*Callback should fire after First action has stopped*/
     }
   });
 };


$(document).ready(function() 
   $('p').myPlugin({
     onShow: function() {
     alert('My callback!');/*Both actions(element hiding and alert ) 
                             fire simultaneously, but I need alert 
                             to fire after element is hidden*/
      }
   });
});
</code></pre>
