Event.observeMethod: More AOP for JavaScript

Christos Constandinou has created Event.observeMethod, a library that gives you a way of adding event listeners to methods in an object and running other methods before, around and/ or after the method you are listening to. The code itself is small, based on Prototype, and only 49 lines (1.8kb), uncompressed.
JAVASCRIPT:
  1. Event.observeMethod( window, 'myNewFunc', myBeforeFunc, Event.BEFORE );
  2. Event.observeMethod( Friend, "initialize", this.addBirthday.bind( this ) );
Dojo has allowed you to do this kind of thing in its connect() model. You tend to wonder how often people need this granularity versus just being able to attach normal events. It makes a lot of sense in large scale applications, but maybe not your JS hacking?

Zero. Zilch. Nada. None. No commento.

Feel free to leave related comments here!

Rather Leave A Voice Comment?

Feel free to leave voice comments here!

Social Bookmarking

del.icio.us:Event.observeMethod: More AOP for JavaScript digg:Event.observeMethod: More AOP for JavaScript spurl:Event.observeMethod: More AOP for JavaScript furl:Event.observeMethod: More AOP for JavaScript Y!:Event.observeMethod: More AOP for JavaScript

Leave a comment

The most recent replies are displayed at the top. Please comment accordingly. Your name and email are required. Track comments via RSS.

Next Generation Ecommerce Software & Web Store Platform > Fast, Simple, Friendly Stores
RSS
Stores  Features  Blog  Archives  About  Contact       © 2006 Web 2.0 Stores