3 ms·
Before anyone gets too upset: both Batman.js and the code examples are written in Coffeescript. If you wish, you may write Batman apps in js, since Batman compi
by ktusznio 15y ago
Before anyone gets too upset: both Batman.js and the code examples are written in Coffeescript. If you wish, you may write Batman apps in js, since Batman compiles to native js.
Calling it Batman.coffee just didn't sound as cool.
- MatthewPhillips 15y agoIt would be very unpleasant to write a Batman app in js since it's dependent on CoffeeScript's "extends" capability (which can be recreated in js, but would be unpleasant as most frameworks handle this sort of thing for you). Of course this can be fixed if they decide to provide a Batman.extend() method. Looks very nice! I'm certainly excited to try this out on mobile, as it sounds pretty perfect for that. I'd rather wait for pushState support as I dislike hangbangs. Looking at the source, it would likely be easy to create alternate storage adapters, which is something I'm interested in.
- roopeshv 15y agowell, you can use jQuery.extend(whateverBatman, *methods) if you want to extend it. (i don't do much JS, but I know just enough to write really bad code)
- rahrens 15y agoWhile similarly named, these functions actually do quite different things. jQuery.extend is a function which copies references to properties out of later objects into the first argument. CoffeeScript's extends is a language keyword which creates inheritance relationships in CoffeeScript's built in object model. (Which is similar but not identical to the object model in Backbone.js.)
- asolove 15y agoNo, jQuery.extend copies properties. It is not the same as CoffeeScript's extend, which uses prototypal inheritance as well as copying static properties.
- DanielRibeiro 15y agoExtends is compiled into JS. You can add it to Batman: var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; Batman.extends = __extends
- deleted 15y ago[deleted]