JavaScriptDesignPatterns:JavaScript设计模式学习

时间:2021-05-29 17:20:15
【文件属性】:
文件名称:JavaScriptDesignPatterns:JavaScript设计模式学习
文件大小:52KB
文件格式:ZIP
更新时间:2021-05-29 17:20:15
JavaScript JavaScriptDesignPatterns 1.外观模式 外观模式(facade):为一组复杂的子系统接口提供一个更高级的统一接口,通过这个接口使得对子系统接口的访问更容易。 1.简化底层接口复杂性,解决浏览器兼容性问题 // 外观模式实现 function addEvent(dom, type, fn) { // 对于支持dom2级事件处理程序 addEventListener方法的浏览器 if (dom.addEventListener) { dom.addEventListener(type, fn, false); } // 对于支持 attachEvent 方法的浏览器 else if (dom.attachEvent) { dom.attachEvent('on' + type, fn); } // 对于支持 on + 事件名的
【文件预览】:
JavaScriptDesignPatterns-master
----command()
--------index2.html(2KB)
--------index.html(2KB)
--------command4.js(796B)
--------with_command.js(3KB)
--------command3.js(1KB)
--------no_command.js(715B)
--------test()
--------command_pattern.md(18KB)
--------command.js(993B)
--------command2.js(3KB)
----observer_pattern()
--------observer.js(3KB)
----index.html(1KB)
----state_pattern()
--------use_state.js(4KB)
--------nonuse_state.js(4KB)
----facade_pattern()
--------use_facade2.js(601B)
--------use_facade1.js(521B)
----.vscode()
--------settings.json(109B)
----chart_text()
--------test1.js(1KB)
--------dist()
----singleton_pattern()
--------index2.js(2KB)
--------dist()
--------index.js(1KB)
----strategic_pattern()
--------use_statategic2.js(2KB)
--------use_statategic1.js(1KB)
----README.md(25KB)
----adapter()
--------adapter.ts(2KB)
--------adapter.dart(1KB)
--------dist()
----proxy_pattern2()
--------index2.js(2KB)
--------dist()
--------index.js(2KB)
----proxy_pattern()
--------nonuse_proxy.js(591B)
--------dist()
--------use_proxy.js(1KB)
----strategy_pattern()
--------strategy1.js(3KB)
--------test.js(829B)
--------strategy2.js(3KB)
----.gitignore(5B)

网友评论