Created
October 5, 2012 12:09
-
-
Save bengourley/3839461 to your computer and use it in GitHub Desktop.
module.js example usage
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
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) | |
} | |
}) |
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
<!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> |
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
(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