模块化开发:增强、克隆与继承技术解析
1. 模块增强(Module Augmentation)
模块增强是一种强大的技术,可用于扩展和修改现有模块的功能。下面我们将详细介绍如何使用紧密增强(tight augmentation)技术来增强模块,并动态生成应用程序的内容区域。
1.1 紧密增强示例
以下是一个在 Modules_3.js 文件中使用紧密增强技术的示例代码:
(function(coreModule){
if(!coreModule){
ImagesInc_LoggingHandler.logError('coreModule was not found to be augmented!');
alert('coreModule was not found to be augmented!');
return false;
}
coreModule.original_someText = coreModule.someText;
coreModule.someText = "this is a test for overriding module properties with TIGHT augmentation!";
coreModule.getExtendedModuleMsg = function(){
ImagesInc_LoggingHandler.logInfo(coreModule.someText);
};
c
超级会员免费看
订阅专栏 解锁全文
1110

被折叠的 条评论
为什么被折叠?



