2.3.1 • Published 11 years ago

classical v2.3.1

Weekly downloads
54
License
-
Repository
github
Last release
11 years ago

Classical

A simple cross-platform functional provider of classical inheritance for Javascript.

Documentation

Creating a Class

var Mammal = require('classical').create(function() {
    this.name                           = null;

    this.constructor = function(name) {
        this.name                       = name;
    };

    this.speak = function(text) {
        console.log('%s says, "%s"', this.name, text);
    };
});

Extension

var Dog = Mammal.extend(function() {
    this.breed                          = null;

    this.constructor = function(name, breed) {
        this.breed                      = breed;
    };

    this.speak = function() {
        this.super.speak('Woof!');
    }
});

Instantiation

var Spot = new Dog('Spot', 'Dalmation');
Spot.speak(); // Outputs: 'Spot says, "Woof!"' to the console.

Interfaces

var Animal = require('classical').interface(function() {
    this.speak                          = function() {};
});
Mammal.implements(Animal);
2.3.1

11 years ago

2.3.0

11 years ago

2.2.13

11 years ago

2.2.12

11 years ago

2.2.11

11 years ago

2.2.10

11 years ago

2.2.9

11 years ago

2.2.8

12 years ago

2.2.7

12 years ago

2.2.6

12 years ago

2.2.5

12 years ago

2.2.4

12 years ago

2.2.3

12 years ago

2.2.2

12 years ago

2.2.1

12 years ago

2.2.0

12 years ago

1.2.1

12 years ago