Skip to content

Instantly share code, notes, and snippets.

Created September 4, 2013 16:26
Show Gist options
  • Save anonymous/6439418 to your computer and use it in GitHub Desktop.
Save anonymous/6439418 to your computer and use it in GitHub Desktop.
Tried separating the functions that were in index.html to "Logic.js"
<html>
<head>
....
<script data-main="" src="libraries/require.js"></script>
...
<script type="text/javascript">
require.config({
baseUrl: '',
paths: {
jquery: 'libraries/jquery-1.10.2.min'
}
});
require(['simulatorConfiguration.js',
'modelConfiguration.js',
'jquery',
'libraries/jquery.lightbox_me.js',
'libraries/jquery-migrate-1.2.1.js',
'libraries/raphael-min.js',
'Logic'], function(
simulatorConfiguration,
modelConfiguration,
jquery,
lightbox,
migrate,
raphael,
Logic) {
$(function() {
Logic.loadPage(); //<--- CALL LOAD PAGE, but it can't find the function
//do some jquery stuff
});
});
</script>
</head>
.....
//function that get's called on body onload!
define('loadPage', function loadPage()
{
hideAllDivs();
//more jquery stuff...
createModelMenu();
//more jquery stuff...
});
define('hideAllDivs', function hideAllDivs()
{
//some UI stuff...
});
define('createModelMenu', function createModelMenu()
{
//some jquery stuff...
});
define('createTestMenu', function createTestMenu(model_key)
{
var javascriptLoc = "models/" + models[model_key].modelDir + "/testConfiguration.js";
require([javascriptLoc], function(util) {
showModelInformation(model_key);
//some Jquery stuff...
});
});
define('showModelInformation', function showModelInformation(model_key)
{
hideAllDivs();
//some jquery stuff
});
define('showTest', function showTest(test_key)
{
hideAllDivs();
//some RaphaelJS stuff...
});
define('takeControl', function takeControl()
{
//some UI stuff
});
define('giveUpControl', function giveUpControl()
{
//some UI stuff...
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment