Aspects = function(){};
Aspects.prototype={
  before:function(method,advice){
	
	
    var original  = this[method];
    this[method] = function(){
      (advice)();
      original.apply(this,arguments);
    }
  },
  after:function(method,advice){
    var original  = this[method];
    this[method] = function(){
      original.apply(this,arguments);
      var args = method;
      advice.call(original,method);
    }
  },
  around:function(method,advice){
    var original  = this[method];
    this[method] = function(){
      (advice)();
       original.apply(this,arguments);
      (advice)();
    }
  }
}

posted on 2010-11-25 17:51  wblade  阅读(357)  评论(0编辑  收藏  举报