【转】《JavaScript设计模式与开发实践》模式篇(1)—— 装饰者模式
使用AOP实现装饰者模式
首先给出 Function.prototype.before 方法和 Function.prototype.after 方法
Function.prototype.before = function( beforefn ){
var __self = this; // 保存原函数的引用
return function(){ // 返回包含了原函数和新函数的...
转载
2019-01-07 14:03:34 ·
107 阅读 ·
0 评论