Aspect Oriented Javascript, revisited
0
Last night I was experimenting a bit with a minimalist implementation of
advising in Aspect Oriented Javascript. I implemented the three basic advices
(before, around and after). For this naive implementation I slammed the
functions in the Object’s prototype. This way I had access to them in all
objects in the system.
Here’s how to use them.
The actual code written is very small (20 lines, less if you discount lines
taken by braces)
This way you can add any sorts of filters to your JavaScript methods. An enhancement
on this would be enabling the removal of these filters once added and to add a
filter to all functions of an object (recursively) at once.
Obviously, we need some protection against users trying to advise non
function members or even undefined properties for that matter.
Post a Comment
eSpace podcast Prodcast
Archive
Latest Comments
- SpectraMind Commented on Egypt Wins UK's National Outsourcing Association Award
- Rofaida Awad Commented on Go Egypt Go!
- Different Mike Commented on Only idiots change their iPhone root password!
- Mike Commented on Only idiots change their iPhone root password!
- smile Commented on Only idiots change their iPhone root password!

