class
Install
$ npm install bloody-class
Require
var klass =
Definition
Classes are objects that contain inherits for instances. You can extend and create instances of an existing class. Classes are based on prototypal inheritance, that way, you can easily update all subclasses and instances from one of their parent class.
Methods
klass.extend([object])
-> newClass
Creates a new class that inherits from klass
. Optionaly takes an object
arguments that extends the newClass
as owned properties.
object
object.mixins
: array
list of classes the given class should compose with.
klass.create([args …])
-> newInstance
Creates a new instance that inherits from klass
. Its arguments are passed to
klass.constructor
which is called if klass
owns a constructor
method.
instance.destroy([args …])
Removes all the internal references to instance
, as in parent.instances
for
instance. Its arguments are passed to klass.destructor
which is called if
klass
owns a destructor
method.
instance.accessor(name) > function
Returns a function that calls instance[name]
with instance
as thisValue
and passes its arguments to the method.
Example
var klass = var $ = var view = klass var myView = view