Tone.js/examples/require.html
2015-06-27 17:25:01 -04:00

48 lines
No EOL
1.4 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>MODULE LOADERS</title>
<script type="text/javascript" src="./scripts/require.js"></script>
<script type="text/javascript" src="./scripts/jquery.min.js"></script>
<script type="text/javascript" src="./scripts/Interface.js"></script>
<link rel="stylesheet" type="text/css" href="./style/examples.css">
</head>
<body>
<div id="Content" class="FullScreen">
<div id="Title">Module Loaders</div>
<div id="Explanation">
<a href="http://requirejs.org/" target="_blank">RequireJS</a>
is a powerful module and build system which Tone.js uses internally.
By only including the modules that your application needs, your build can be
much smaller and your code much more modular.
<br><br>
If you use RequireJS (or any other UMD module loader), but build-size is less of a concern,
you can simply include the entire Tone.js build.
<br><br>
Take a look at the source to see how.
</div>
</div>
<script type="text/javascript">
require.config({
baseUrl : "./",
//make a path to the Tone.js/Tone directory
//then include the sources as they are below
paths : {
"Tone" : "../Tone",
}
});
require(["Tone/core/Master", "Tone/instrument/SimpleSynth"],
function(Master, SimpleSynth){
var synth = new SimpleSynth().toMaster();
synth.triggerAttackRelease("C4", "8n");
});
</script>
</body>
</html>