Skip to content

Instantly share code, notes, and snippets.

@batok
Created February 10, 2014 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save batok/8921554 to your computer and use it in GitHub Desktop.
Save batok/8921554 to your computer and use it in GitHub Desktop.
Using sweet.js to write less code in ember.js
macro to_string {
case { _ $tok } => { return [makeValue(unwrapSyntax(#{ $tok }), #{ $tok })]; }
}
macro <. {
case { _ $vari} => {
return #{
this.get( to_string $vari )
}
}
}
App.IndexController = Em.Controller.extend({
firstName: "Mickey",
lastName : "Mouse",
fullName: function(){
return <.firstName + ' ' + <.lastName
}.property( "firstName", "lastName" ),
actions: {
selected: function(){
console.log( <.fullName );
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment