title: how to create jquery function using onstart and oncomplete
body: <p>I'm trying to create my own jquery function, I know how to add options but don't know how to add 'onStart' or 'onComplete' functionality.</p>
  
  <p>this is what I know so far:</p>
  
  <pre><code>jQuery.somefunctionname = function (options) {
  var settings = {},
      defaults = {
          'someoption': 'somevalue',
          'someoption2': 'somevalue2',
          'someoption3': 'somevalue3'
      }
  settings = $.extend({}, defaults, options);
  
      //do something functional
      alert("hey i'm a function");
  }
  </code></pre>
  
  <p>But If I want the user to be able to add their own code in before (onStart) and after (onComplete) my function, what should I code?</p>
  
  <p>User should be able to write like this:</p>
  
  <pre><code>$.somefunctionname({
     'someoption' : 'a',
     'someoption2' : 'b',
     'someoption3' : 'c',
  
     'onStart' : function() {
        //whatever user want when my function started
     },
     'onComplete' : function() {
        //whatever user want when my function ended
     } });
  </code></pre>
  
  <p>thx ;)</p>