Next: , Up: Interoperability   [Contents]

4.1 Using GNU ease.js Classes Outside of ease.js

GNU ease.js is a prototype generator—it takes the class definition, applies its validations and conveniences, and generates a prototype and constructor that can be instantiated and used just as any other ECMAScript constructor/prototype. One thing to note immediately, as mentioned in the section Defining Classes, is that constructors generated by ease.js may be instantiated either with or without the new keyword:

  var Foo = Class( { /*...*/ } );

  // both of these are equivalent
  new Foo();

Figure 4.1: Constructors generated by ease.js may omit the new keyword

ease.js convention is to omit the keyword for more concise code that is more easily chained, but you should follow the coding conventions of the project that you are working on.