Created
May 11, 2015 12:49
-
-
Save wwsun/c9114465742095e0759f to your computer and use it in GitHub Desktop.
AMD Demo
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
define([], function() { | |
return 'Example file'; | |
}); |
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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=Edge"> | |
<title>AMD example</title> | |
</head> | |
<body> | |
<script src="require.js"></script> | |
<script> | |
require({ | |
'paths': { | |
'example': './example' | |
} | |
}, ['example'], function(example) { | |
alert('Hello from "' + example + '"'); | |
}); | |
</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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=Edge"> | |
<title>AMD example</title> | |
</head> | |
<body> | |
<script src="require.js"></script> | |
<script> | |
require({ | |
'paths': { | |
'jquery': 'http://code.jquery.com/jquery-2.1.3' | |
} | |
}, ['jquery'], function($) { | |
alert('jQuery version: ' + $.fn.jquery); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment