摘要: Aop.jsMy excursions into the dark recess of my/jsdirectory continue. This was originally something I wrote a while back when I was learning aboutAspect-oriented programmingin Java and wanted see how much trouble it would be to write something similar for JavaScript. As it turned out, writing the cor 阅读全文
posted @ 2011-03-04 14:07 李传涛 阅读(840) 评论(0) 推荐(0) 编辑
摘要: 今天查看了一下AOP在JavaScript中的实现,个人感觉三生石上的实现较好,简单记录一下:var aspect = { before: function(context, targetName, fn) { var target = context[targetName]; context[targetName] = function() { return target.apply(context, fn.apply(context, arguments)); }; }, after: function(context, targetName, fn) { var target = con 阅读全文
posted @ 2011-03-04 13:33 李传涛 阅读(1458) 评论(0) 推荐(0) 编辑