requirejs + emberjs default structure
define 'app', [
'app/controllers/application_controller',
'app/views/application_view',
'app/store'
], (AppController, AppView, Store) ->
App = App.create(rootElement: "#app")
App.referReadiness()
App.ApplicationController = AppController
App.ApplicationView = AppView
App.Store = Store
App.Route.map ->
@route "home", path: "/"
window.App = App
define 'app/views/home_view', ['app'], (App) ->
App.HomeView = Ember.View.extend(...)
define 'app/controllers/home_controller', ['app'], (App) ->
App.HomeController = Ember.Controller.extend(...)
define 'app/routes/home_route', ['app'], (App) ->
App.HomeRoute = Ember.Route.extend(..)
define 'home', ['app/views/home_view', 'app/controllers/home_controller', 'app/routers/home_route'], (App) ->
App.advanceReadiness()
require ['home'] # loads 'app', then 'home_*'
Written by Malik Baktiyarov
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Coffeescript
Authors
iam4x
94.17K
ericdfields
63.02K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#