title: Delegating a function call in Javascript
body: <p>Is there a way in Javascript to have a delegate like the ones in c# ? </p>
  
  <p>Example in c# </p>
  
  <pre><code>Object.onFunctionCall = delegate (vars v) {
      Console.WriteLine("I can do something in this private delegate function");
  };
  </code></pre>
  
  <p>I would like with my Javascript to have my main object do something over a long time, and shot a delegate once in a while to give a little update. All that without having to change the code itself of my class to adjust for the webpage.</p>
  
  <pre><code>function mainObject() {
      this.onUpdate = function() { //Potentially the delegate function here
      }
  }
  
  var a = new mainObject();
  a.onUpdate = Delegate {
        $(".myText").text("Just got a delegate update");
  } 
  </code></pre>
  
  <p>I dunno if it's clear enough.. havent found ressources on this so I suppose there is just no way to do so ?</p>
  
  <p><strong>NOTE</strong>: I am not looking into jquery Click delegates event here, but into delegating a function call like how it works in c# </p>
  
  <p>Let me know</p>