Home >Web Front-end >JS Tutorial >The seventh way to write classes in javascript_js object-oriented
, How to write classes in dojo.js
The latest version of dojo is 1.3.1. I remember it was still 0.4 in 2007. There are gradually more documents, and more and more people use Dojo. Dojo also released a core version, which is only 27kb after compression. Dojo uses the dojo.declare method to define a class. The source code of dojo.declare is not posted here. dojo.declare has three parameters,
Parameter 1: class name className
Parameter 2: inherited class superclass
Parameter 3: constructor, method props
To simply define a class, you only need to pass the first One and three parameters. Because we only discuss how to define a class here, not inheritance. The code is as follows: