Last active
August 29, 2015 14:06
-
-
Save kristianmandrup/6718631ec36319571da8 to your computer and use it in GitHub Desktop.
Ember DSL idea for ES6 modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember' | |
module.exports = | |
controller: (name) -> | |
unless ['array', 'object'].find name | |
throw "Invalid Ember controller" | |
Ember["#{name.camelize}Controller"] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# models/post.js | |
import model from 'model-dsl' | |
Post = model | |
title: attr('string') | |
count: attr('integer') | |
# controllers/post.js | |
import controller from 'controller-dsl' | |
PostController = controller | |
actions: | |
hello: -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data' | |
module.export = | |
model: DS.Model.extend | |
attr: DS.attr | |
hasMany: DS.hasMany | |
belongsTo: DS.hasMany |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember' | |
module.exports = | |
router: Ember.Router.extend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment