NAME

Subclass - Simple Javascript Subclassing


SYNOPSIS

    proto = Subclass('Project.Foo');
    proto.something = function(x, y) {
        ...
    }
    proto = Subclass('Project.Bar', 'Project.Foo') {
    proto.somthing = function(x, y) {
        ...
        this.superfunc('something').apply(arguments);
        ...
    }
    proto.other = function(a, b) {
        ...
    }


DESCRIPTION

Subclass is a function that generates a class; optionally as a subclass of another class.

By ``class'', we mean that Subclass generates a constructor, puts it in the correct namespace, and returns the constructor's prototype.

It's that simple. Subclass does not try to be an entire framework for Javascript. It's just a small tool that does one thing well.

Subclass does add 3 properties to each class though: classname, superclass and superfunc. The latter is a function that can be used to find a super function at runtime.


AUTHOR

Ingy döt Net <ingy@cpan.org>


COPYRIGHT

Copyright (c) 2006. Ingy döt Net. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html