Created
December 12, 2014 00:55
-
-
Save devdays/cc68095c275e12b9443e to your computer and use it in GitHub Desktop.
Object JavaScript - Loading and Running the dependency
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
//product.html | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Simple RequireJS Sample</title> | |
<script src="scripts/require.js"></script> | |
<script> | |
requirejs.config({ | |
//By default load any module IDs from Scripts folder | |
baseUrl: 'Scripts' | |
}); | |
// load the discount.js and use that module to calculate employee discount | |
require(['discount'], | |
function (discount) { | |
var d = discount.calculateDiscount('employee'); | |
document.write('employee discount is ' + d + '%'); | |
}); | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment