Last active
September 8, 2015 19:45
-
-
Save jstrimpel/99d0009f677a0e196cf3 to your computer and use it in GitHub Desktop.
code sample pattern
This file contains hidden or 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
// this outlines the recommended approach for handling code samples in the book | |
// block 1 introdcues a stubbed module | |
// block 2 contains implementation details for subbed module method | |
// this prevents duplication while still providing context | |
// comments before code block would be the code block tile in the book | |
// [[app_stub_2_4]] | |
// Application Stub | |
export default class Application { | |
constructor(routes, options) { | |
} | |
navigate(url, push=true) { | |
} | |
start() { | |
} | |
} | |
// [[app_constructor_2_4]] | |
// <<app_stub_2_4>> constructor method | |
constructor() { | |
// save off routes as look up table for controllers | |
this.routes = routes; | |
this.options = options; | |
// create a call router instance | |
this.router = new Call.Router(); | |
this.registerRoutes(routes); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment