Last active
September 3, 2015 21:09
-
-
Save jbnv/e0ce446fab13cdd3fb32 to your computer and use it in GitHub Desktop.
A basic Durandal application. Based on content from http://www.infoq.com/articles/durandal-javascript-framework.
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
// All code in Durandal is written in modules and takes the following form: | |
define(function (require) { | |
var someModule = require('some-module'); | |
//TODO ...other modules required here... | |
return someValue; | |
}); |
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
<html> | |
<head> | |
<link rel="stylesheet" href="lib/durandal/css/durandal.css" /> | |
<!-- Other CSS libraries go here. --> | |
</head> | |
<body> | |
<div id="applicationHost"></div> | |
<script src="lib/require/require.js" data-main="app/main"></script> | |
</body> | |
</html> |
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
// requirejs.config() configures the module system so that it can find our core libraries. | |
// define() follows the define() pattern as shown in 'define.js'. | |
requirejs.config({ | |
paths: { // for example: | |
'text': '../lib/require/text', | |
'durandal':'../lib/durandal/js', | |
'plugins' : '../lib/durandal/js/plugins', | |
'transitions' : '../lib/durandal/js/transitions', | |
'knockout': '../lib/knockout/knockout-2.3.0', | |
'jquery': '../lib/jquery/jquery-1.9.1' | |
} | |
}); | |
define(function (require) { | |
var system = require('durandal/system'), app = require('durandal/app'); | |
system.debug(true); | |
app.title = 'TITLE GOES HERE'; | |
app.configurePlugins({ | |
router: true, | |
dialog: true | |
}); | |
app.start().then(function() { | |
app.setRoot('shell'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment