3 ms·
I used batmanjs on a project a bit ago and enjoyed it a lot due to the API being designed specifically for CoffeScript. It used the `class` construct instead o
by ratbeard 14y ago
I used batmanjs on a project a bit ago and enjoyed it a lot due to the API being designed specifically for CoffeScript.
It used the `class` construct instead of building its own Object.extend class system like most libraries do. Not only is that simpler, its much more powerful than the standard 'prototype = object literal' approach as CofeeScript classes have executable class bodies, so you can build macro-like class-level methods similar to ruby:
class Alfred.Todo extends Batman.Model
@persist Batman.LocalStorage
@encode 'body', 'isDone'
@validate 'body', present: true
From my brief glance at Ember it seems like the pattern to add macro behavior is to wrap property values in calls to things like `Ember.computed` which looks pretty clunky.