Created
May 30, 2012 16:06
-
-
Save quangv/2837278 to your computer and use it in GitHub Desktop.
Proposal: Ability to fire routes additions if necessary Spine.js
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
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 |
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
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 |
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
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