Skip to content

Instantly share code, notes, and snippets.

@bengourley
Created October 5, 2012 12:09
Show Gist options
  • Save bengourley/3839461 to your computer and use it in GitHub Desktop.
Save bengourley/3839461 to your computer and use it in GitHub Desktop.
module.js example usage
module('flyout', function (module) {
module.exports = flyout
function flyout() {
// Use jQuery as $ is in the global
// scope and available w/out require()
$('.flyout').animate({ ... }, 300)
}
})
<!DOCTYPE html>
<html>
<head><!-- Title etc. --></head>
<body>
<!-- Content here -->
<script src="jquery.js"></script>
<script src="module.js"></script>
<script src="flyout.js"></script>
<script src="main.js"></script>
</body>
</html>
(function () {
// This is the main entry point for your app,
// flyout won't run until you require() it.
var flyout = require('flyout')
$(document).on('click', flyout)
}())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment