Lazy and unobturisve JavaScript inheritance helper
Installation
Node
npm install lazy-extendable
Browser
Download and reference via script
Why another inheritance framework?
Proper naming
It's not a Klass
, and not even Class
. It's just JavaScript inheritance helper and it's called LazyExtendable
.
If you want to create new extendable type you call new LazyExtendable()
or LazyExtendable.create()
, not .extend
. Want to extend your type? Use YourType.extend()
.
Unobtrusiveness
It doesn't add any own properties to prototype. Want add base
or super
property to you type? Now you can.
Lazyness
Have a huge type hierarchy and it's all built every time, even when unneeded? Forget it, now certain types will be built only if you use them.
Advanced overriding
It's not necessary to change base types, just override method you need and call any base method you want.
var Woman = { return { var buffer = ; buffer; buffer; buffer; return buffer; } { return 'Here you are, jerk!'; } { return 'Hello my darling.'; } { return 'Take this!'; } ;}; var PoliteWoman = Woman;
Naming again
Now you can name base instance as you want. Like Java? Call base methods via super
. Like C#? Call via base
. Like LOTR? Call it via gandalfTheGrey
.
Advanced IDE autocompletion
You can specify exact type of base type with annotations your IDE understand and get better autocompletion behavior.