Comparing version 0.2.1 to 0.2.2
{ | ||
"name" : "clazzy", | ||
"version" : "0.2.1", | ||
"version" : "0.2.2", | ||
@@ -47,3 +47,8 @@ "description" : "A cross platform JavaScript library that provides a classical interface to prototypal inheritance.", | ||
"license" : "MIT" | ||
"license" : "MIT", | ||
"scripts" : | ||
{ | ||
"test" : "grunt test" | ||
} | ||
} |
# Clazzy | ||
![Travis Build Status](https://travis-ci.org/lsphillips/Clazzy.svg?branch=master) | ||
A cross platform JavaScript library that provides a classical interface to prototypal inheritance. | ||
**This project is now deprecated in favor of the ECMAScript 6 class syntax, this project will no longer be maintained. Sorry!** | ||
**This project is now deprecated in favor of the ECMAScript 6 class syntax, this project will no longer be maintained.** | ||
## Usage | ||
Clazzy has a single method with this signature: | ||
``` | ||
Function Clazzy.create(Object definition) | ||
``` | ||
It returns a constructor function, with a prototype populated using the provided definition, that you can instantiate using the `new` keyword. | ||
### Creating a class | ||
@@ -14,4 +24,2 @@ | ||
{ | ||
// Constructor | ||
initialize : function () | ||
@@ -22,4 +30,2 @@ { | ||
// Instance methods | ||
bar : function () | ||
@@ -35,4 +41,2 @@ { | ||
// Static methods | ||
static : | ||
@@ -46,15 +50,5 @@ { | ||
}); | ||
var foo = new Foo(); | ||
foo.foo; // 'foo' | ||
foo.bar(); // 'bar' | ||
foo.baz('baz'); // 'baz' | ||
Foo.qux(); // 'qux' | ||
``` | ||
**Note:** Instance properties can be defined in the definition, however their inital value should be set in the constructor. | ||
**Note:** Instance properties can be defined in the definition, however their initial value should be set in the constructor. | ||
@@ -85,14 +79,2 @@ ### Creating a class that extends another class | ||
}); | ||
var bar = new Bar(); | ||
bar.foo; // 'foo' | ||
bar.corge; // 'corge' | ||
bar.bar(); // 'bar' | ||
bar.baz('qux'); // 'super qux' | ||
Bar.qux(); // throws an error | ||
``` | ||
@@ -107,3 +89,3 @@ | ||
Clazzy provides a method of code reuse called includes. Behaving similarly to Ruby's mixins and PHP's traits, they enable a developer to reuse sets of methods freely in several independent classes living in different class hierarchies. | ||
Clazzy provides a method of code reuse called includes. Behaving similarly to Ruby's mixins and PHP's traits, they enable a developer to reuse sets of methods freely in several independent classes defined in different class hierarchies. | ||
@@ -120,14 +102,2 @@ ``` js | ||
}); | ||
var baz = new Baz(); | ||
baz.foo; // 'foo' | ||
baz.bar(); // 'bar' | ||
baz.baz('baz'); // 'baz' | ||
baz.moo(); // 'moo' | ||
Baz.qux(); // throws an error | ||
``` | ||
@@ -134,0 +104,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12029
6
131