0.1.0 • Published 12 years ago

superclass v0.1.0

Weekly downloads
3
License
-
Repository
github
Last release
12 years ago

jssuper

You can access to method and constructor of super class like Java.

Initalize

node:

//add option "--harmony_proxies"
require('superclass');

web:

<script src="path/to/superclass.js"></script>

Usage

Access to constructor:

function A(message) {
    this.message = message;
}

function B() {
    this.super('hello!');
}
B.prototype = Object.create(A.prototype);

Access to method:

A.prototype.foo = function() {
    return '#' + this.message + '#';
};

B.prototype.foo = function() {
    return '(' + this.super.foo() + ')';
};
0.1.0

12 years ago