Class
javascript class framework
Used for fast deploying of classes by inheriting existent ones.
Instalation
npm install findhit-class --save
Usage
var Class = ;
Features
Extendable
// Class creation by extending Class var MyClass = Class; // Extending MyClass to a new Class // Inheriting initialize and destroy function var MyNewClass = MyClass;
Hookable
// Since we want to inherite initialize, we may also add an hook for this class MyClass; // And also for destroying MyClass; // WARNING: // Hooks also run on parent classes when an instance is constructed!
Associable
// Initialize some vars var Gun = Class Bullet = Class; // Associating them Gun; Bullet; // Creating instances var gun = 'colt' bulletOne = 'alpha' bulletStupid = 'whoote' bulletKaeda = 'i kill you' ; // We could associate on multiple ways: // From a bullet pov bulletOneGun = gun; // gun.Bullets should be now equal to [ bulletOne ]; // From a gun pov gunBullets = bulletOne bulletStupid bulletKaeda ; gun; // bulletOne.Gun, bulletStupid.Gun and bulletKaeda.Gun should be now equal to Gun
Optionable
// Initialize some vars var Gun = Class; var Colt = Gun; var gun = colt = ; gunoptions; // { silent: false } coltoptions; // { silent: true, color: undefined, model: undefined }
Thanks
Huge thanks to Leaflet, John Resig and Dean Edwards.