Re:Announcing the first release of batman.js
by jashkenas on Thursday August 25, 2011 @12:14AM
(#2923744)
It is indeed nasty ... and for that extra nastiness, above and beyond the inheritance pattern listed above, you get:
* A subclass that inherits the parent's implementation of the constructor function, unless overridden.
* A named function for your class object, without IE scope leaks.
* A way to call super that's as easy as `super()`.
* Inheritance of the parent's own properties (unfortunately via copying).
* ... which enables helpful metaprogramming within class bodies. For example, Batman's own `event` decorator:
use: @event (times) ->
return false unless ...
Backbone handles the messy inheritance code for you. Batman.js relies on CS for that, but a JS dev is going to have to write the inheritance code by hand. I posted the JS equivalent of their example in this thread, it's nasty.