Zepto源码分析-架构

构造函数

  Zepto.js 是专门为智能手机浏览器推出的javascript库, 拥有与和jQuery相似的语法。
  它的优点是精简,压缩后5-10K。
  不支持IE
  MIT开源协议

结构   http://zeptojs.com/(1.6.1版本)

 
  

架构

  

自调用匿名函数

/**
* 整体上的自调用匿名函数,是避免与其他模块变量/方法 污染。降低与其他模块的耦合度。‘高内聚,低耦合’的设计
* 尽量在prototype上定义变量和方法,让每个Zepto对象继承,大幅降低每个Zepto对象的内存。
*
*/

扫描二维码关注公众号,回复: 6734027 查看本文章

var Zepto = (function() {
...
})()

// If `$` is not yet defined, point it to `Zepto`
window.Zepto = Zepto
window.$ === undefined && (window.$ = Zepto)

  

转载于:https://www.cnblogs.com/mominger/p/4365612.html

猜你喜欢

转载自blog.csdn.net/weixin_34138139/article/details/93918981