Javascript aspect orientated programming with ES7 decorators.
npm install decorator-aop
Assign the class to the aspect.
@Aspect.target(Example)
class ExampleAspect extends Aspect {
}
Use the following decorators to register join points on the aspect.
@Aspect.before('myMethod')
doBeforeMyMethod(target, args) {
console.log('executed before myMethod is called');
}
@Aspect.after('myMethod')
doAfterMyMethod(target, args) {
console.log('executed after myMethod is called');
}
@Aspect.intercept('myMethod')
doInterceptMyMethod(target, args, proceed) {
console.log('intercept the execution of myMethod');
return proceed.apply(target, args);
}