摘要
随着互联网的普及,前端技术也得到了迅速发展。为了深入了解前端开发中的框架设计原理,以Zepto前端框架为例,利用Javascript原型链的相关知识,采用原生Javascript与框架对比的方法剖析了框架整体设计思路,细致分析了框架的大致架构,重构了Zepto对象原型,并封装了可能用到的所有方法。利用这种从宏观到微观的研究视角,最终呈现了一个框架的整体细致构造及其与底层原生Javascript的联系,以便于开发者熟悉框架设计原理,更好地设计出自己的框架。
In order to gain a better understanding of the framework design principles in front-end development,we take the front-end framework of Zepto as an example,use Javascript prototype chain,native Javascript and frame comparison method to analyze the framework of the overall design ideas.We have detailed analysis of the framework of the general structure,reconstruct Zepto object prototype,and encapsulate all the methods that will be used.Based on the micro-to-micro perspective,we present a framework of the overall structure and its relationship with the underlying native Javascript,which help developers familiarize framework design principles to better establish their frameworks.
作者
王运
倪静
WANG Yun;NI Jing(School of Management,University of Shanghai for Science and Technology,Shanghai 200091,China)
出处
《软件导刊》
2018年第4期124-126,共3页
Software Guide