Questions tagged «module-pattern»

3
Javascript:模块模式与构造器/原型模式?
我想知道模块模式或Constructor / protoType模式是否更适合我的工作。 基本上,我使用的是不引人注目的javascript-HTML文档具有对.js文件的引用。 我对模块模式的理解: 调用INIT方法(基本上是一个公共方法,我可以使用模块模式创建和返回) 在INIT方法中,分配所有点击事件等。 这听起来很适合我的情况,因为我不需要创建对象和继承层次结构等。 我对构造函数/原型模式的理解: 用于创建对象 用于使用继承(即超类型的子类型) 我是对的,对于提供简洁的JavaScript,模块模式是理想的吗?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.