Skip to content

Instantly share code, notes, and snippets.

@quangv
Created May 30, 2012 16:06
Show Gist options
  • Save quangv/2837278 to your computer and use it in GitHub Desktop.
Save quangv/2837278 to your computer and use it in GitHub Desktop.
Proposal: Ability to fire routes additions if necessary Spine.js
class Main extends Spine.Controller
constructor : ->
super
@routes { # called after init routes have been loaded, manual trigger needed if path match.
'/app/main' : ->
# do stuff
}, trigger:true
module.exports = Main
class Side extends Spine.Controller
constructor : ->
super
@routes { # called after init routes have been loaded, manual trigger needed if path match.
'/app/side' : ->
# do stuff
}, trigger:true
module.exports = Side
Main = require 'controllers-main'
Side = require 'controllers-side'
class App extends Spine.Controller
initiated : false
constructor : ->
super
@routes # load init routes
'/app' : ->
unless @initiated
@main = new Main
@side = new Side
@initiated = true # so our app only initiate once.
$ ->
window.app = new App
Spine.Route.setup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment