clah
Simple JavaScript Inheritance with bound callbacks
All credit for the inheritance system goes to John Resig. I adapted it to work both with Node.js or in a browser, and added a function to generate bound callbacks.
// define a classvar Person = Class; // define a subclassvar Pirate = Person; 'Jim'; // #=> "Hello, I'm Jim!"'John'; // #=> "Ahoy! Me be John." // create a bound callbackvar jane = 'Jane';var callback = jane; // you can use this callback anywhere, it will always be bound to the instance; // #=> "Hello, I'm Jane!"
Clah is tested with Jasmine and Travis CI.
Installation
With NPM:
npm install clah
In a browser:
<script type='text/javascript' src='/path/to/your/assets/clah.min.js'></script>
Download: Production (minified), Development (uncompressed).