Events on JavaScript Objects

I did a search for javascript events and came up with lots of articles about onclick and onload and all the lovely things we use to make our pages interactive. But in this case, I wanted a C#-style event, like an event on an object. With a little more digging, I found this article about C#-style events which pointed me towards the approach of just keeping a list of the functions that should be triggered by that event. However, I didn’t like the way it was written so I decided to re-implement the same idea in a JavaScript writing style more like this article about JavaScript instant iterators. Here’s the result:

This entry was posted in Development, Uncategorized. Bookmark the permalink.