title: how to Raise a custom event from within a java script object
body: <p>I am trying to get a better understanding of object orientated techniques in Java script.</p>
  
  <p>I have the folowing (Trivial) object. </p>
  
  <pre><code>function CustomObject () {
      this.size = 1;
  };
  
  CustomObject.prototype.addSize = function () {
      this.size += 1;
      if(this.size &gt; 5) {
          //Raise custom Event
      }
  };
  </code></pre>
  
  <p>And I am instating it like this. </p>
  
  <pre><code>   var myObject = new CustomObject();
      myObject.addSize();
  
      // Add listener for custom event from with in my Custom Object.
      // Something like this....
      myObject.addEventListener("CustomEvent", handelCustomEvent, false);
  
      function handelCustomEvent() {}
  </code></pre>
  
  <p>How do I raise a custom event in my custom object and then listen to that event in the parent? Is this kind of thing even possible in Java script?</p>