Skip to content

Instantly share code, notes, and snippets.

@devdays
Created December 12, 2014 00:04
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save devdays/de1a3e9aef8c8436e26b to your computer and use it in GitHub Desktop.
Object JavaScript - RequireJS require
// 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