JS设计模式源代码

源代码在线查看: 4.08 - the augment function.js

软件大小: 80 K
上传用户: BEIJINGHUANYING
关键词: 设计模式 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				/* Augment function. */								function augment(receivingClass, givingClass) {				  for(methodName in givingClass.prototype) { 				    if(!receivingClass.prototype[methodName]) {				      receivingClass.prototype[methodName] = givingClass.prototype[methodName];				    }				  }				}								/* Augment function, improved. */								function augment(receivingClass, givingClass) {				  if(arguments[2]) { // Only give certain methods.				    for(var i = 2, len = arguments.length; i < len; i++) {				      receivingClass.prototype[arguments[i]] = givingClass.prototype[arguments[i]];				    }				  } 				  else { // Give all methods.				    for(methodName in givingClass.prototype) { 				      if(!receivingClass.prototype[methodName]) {				        receivingClass.prototype[methodName] = givingClass.prototype[methodName];				      }				    }				  }				}							

相关资源