Tone.js/examples/require.html

50 lines
1.3 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
2014-04-05 00:24:19 +00:00
<html>
<head>
<meta charset="utf-8">
2015-06-27 21:25:01 +00:00
<title>MODULE LOADERS</title>
2014-04-05 00:24:19 +00:00
<script src="./scripts/StartAudioContext.js"></script>
<script src="./scripts/require.js"></script>
2015-06-27 21:25:01 +00:00
<script src="./scripts/jquery.min.js"></script>
<script src="./scripts/Interface.js"></script>
2015-06-27 21:25:01 +00:00
<link rel="stylesheet" type="text/css" href="./style/examples.css">
2014-04-05 00:24:19 +00:00
</head>
<body>
2015-06-27 21:25:01 +00:00
<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>
2015-06-27 21:25:01 +00:00
2014-04-06 20:51:30 +00:00
require.config({
2015-02-24 17:03:43 +00:00
baseUrl : "./",
2015-06-27 21:25:01 +00:00
//make a path to the Tone.js/Tone directory
//then include the sources as they are below
2015-02-24 17:03:43 +00:00
paths : {
2015-06-27 21:25:01 +00:00
"Tone" : "../Tone",
2015-02-24 17:03:43 +00:00
}
2014-04-06 20:51:30 +00:00
});
require(["Tone/core/Master", "Tone/instrument/Synth"],
function(Master, Synth){
var synth = new Synth().toMaster();
2015-06-27 21:25:01 +00:00
synth.triggerAttackRelease("C4", "8n");
2014-04-16 04:23:58 +00:00
});
2014-04-05 00:24:19 +00:00
</script>
</body>
</html>