Created
September 5, 2013 17:54
-
-
Save anonymous/6453705 to your computer and use it in GitHub Desktop.
RequireJS with multiple functions - how to call a function. Getting "undefined is not a function" error
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
... | |
<script data-main="" src="libraries/require.js"></script> | |
<script type="text/javascript"> | |
//function that get's called on body onload | |
define('loadPage', ['hideAllDivs'], function createLoadPage() | |
{ | |
return function loadPage() | |
{ | |
console.log("here"); | |
hideAllDivs(); | |
}; | |
}); | |
//hide all divs | |
define('hideAllDivs', [], function() | |
{ | |
return function hideAllDivs() | |
{ | |
console.log("hi"); | |
}; | |
}); | |
require(['libraries/jquery-1.10.2.min', 'loadPage'], function(loadPage) { | |
$(function() { | |
loadPage(); //****Getting "undefined is not a function" at THIS line*******// | |
console.log("hello"); | |
}); | |
}); | |
</script> | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment