Klass
An expressive, cross platform JavaScript Class provider with a classical interface to prototypal inheritance.
API
creating a Class
var Person =
Subclassing
var SuperHuman = Person'Zelda'
Object Literal Interface
var Foo =
note: initialize will be called on class invocation
Implement
because sometimes you want to overwrite OR mixin an instance method
// note you can optionally pass an object literal to extend too ;)var Alien = SuperHumanvar Spazoid = 'Zoopo'if beamIsDownSpazoid
Environments
Klass is Common JS compliant and provides the Modules 1.1 interface to allow two flavors of development. See the implementations below:
Browser
<!-- klass() is exposed to context -->
As a node module
npm install klass
var klass =
Ender compatibility
add klass
to your ender compilation
ender add klass
Developers
npm installmakemake test
Keep your edits localized to src/klass.js
LICENSE
MIT