我使用 AOP Jquery,其许可如下:
/**
* jQuery AOP - jQuery plugin to add features of aspect-oriented programming (AOP) to jQuery.
* http://jquery-aop.googlecode.com/
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Version: 1.3
*
* Cross-frame type detection based on Daniel Steigerwald's code (http://daniel.steigerwald.cz)
* http://gist.github.com/204554
*
*/
当我在这些目标中具有相同的方法名称时,我可以定义许多目标吗:
例子:
var Person={
doctor:{
setResume:function(){
}
},
engineer:{
setResume:function(){
}
}
}
代替 :
$.aop.before({
target:Person.doctor,
method:'setResume'},function(args) {
console.log('setResume will be called '):
}
});
$.aop.before({
target:Person.engineer,
method:'setResume'},function(args) {
console.log('setResume will be called '):
}
});
我想例如:
$.aop.before({
target:[Person.doctor,Person.engineer],
// or target :'Person.*' ...
method:'setResume'},function(args) {
console.log('setResume will be called '):
}
});