Created
December 12, 2014 00:04
-
-
Save devdays/de1a3e9aef8c8436e26b to your computer and use it in GitHub Desktop.
Object JavaScript - RequireJS require
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
// on product.html | |
// load the discount.js and use that module to calculate employee discount | |
require( | |
// name of module that is required, ie the depenency | |
['discount'], | |
// the function that uses the discount object | |
function (discount) { | |
var d = discount.calculateDiscount('employee'); | |
document.write('employee discount is ' + d + '%'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment