Can I create a custom event in Javascript for an object I created?
问题 Assume I have an object with a member function that returns itself: /* -- Object 1 -- */ function Object1(){ this.me = new Image(10,10); this.me.src = "someImgUrl.jpg"; this.publish = function(){ return this.me; } } In production: var Obj1 = new Object1(); document.body.appendChild( Obj1.publish() ); Now, suppose I wanted to create an event that fires when the object's publish() method is called, but after the image is returned (something akin to an "onPublished()" event). Say, to to change