Rob Kinyon - Class-0.01
NAME
Class
DESCRIPTION
This provides a useful way to create classes. See below for more details.
DEPENDENCIES
This requires JSAN and Upgrade to be installed.
STATIC CLASSES
These are classes that are not instantiable, but instead provide a useful set of operations. (In Javascript terms, they do not provide a prototype member, so you will never call new upon them.)
Abstract
This class doesn't do anything except provide a useful hook to handle abstract base classe s.
Class
Class provides the create() function which is used to create new classes.
The new class will automatically call its initialize() method,
passing all parameters that were passedto the constructor.
var My.Class = Class.create();
My.Class.prototype = {
initialize: function( param1, param2, ... ) {
this.paramOne = param1;
this.methodCall( param2 );
// Do more stuff here
}
}
SUPPORT
Currently, there is no mailing list or IRC channel. Please send bug reports and patches to the author.
AUTHOR
Rob Kinyon (rob.kinyon@iinteractive.com)
Originally written by Sam Stephenson (sam@conio.net)
My time is generously donated by Infinity Interactive, Inc. http://www.iinteractive.com
/*
=head1 NAME
Class
=head1 DESCRIPTION
This provides a useful way to create classes. See below for more details.
=head1 DEPENDENCIES
This requires JSAN and Upgrade to be installed.
=cut
*/
try {
JSAN.use( 'Upgrade.Function.apply' );
} catch (e) {
throw "Class.js requires JSAN to be loaded";
}
VERSION=0.01;
/*
=head1 STATIC CLASSES
These are classes that are not instantiable, but instead provide a useful set of operations. (In Javascript terms, they do not provide a prototype member, so you will never call new upon them.)
=cut
*/
/*
=head2 Abstract
This class doesn't do anything except provide a useful hook to handle abstract base classe
s.
=cut
*/
var Abstract = new Object();
/*
=head2 Class
Class provides the C<create()> function which is used to create new classes. The new class
will automatically call its initialize() method, passing all parameters that were passedto the constructor.
var My.Class = Class.create();
My.Class.prototype = {
initialize: function( param1, param2, ... ) {
this.paramOne = param1;
this.methodCall( param2 );
// Do more stuff here
}
}
=cut
*/
var Class = {
create: function() {
return function() {
this.initialize.apply(this, arguments);
}
}
};
/*
=head1 SUPPORT
Currently, there is no mailing list or IRC channel. Please send bug reports and patches to the author.
=head1 AUTHOR
Rob Kinyon (rob.kinyon@iinteractive.com)
Originally written by Sam Stephenson (sam@conio.net)
My time is generously donated by Infinity Interactive, Inc. L<http://www.iinteractive.com>
=cut
*/