2014-10-22 22:49:42 +00:00
|
|
|
<!DOCTYPE html>
|
2014-04-05 00:24:19 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
2014-10-22 22:49:42 +00:00
|
|
|
<meta charset="utf-8">
|
2015-06-27 21:25:01 +00:00
|
|
|
<title>MODULE LOADERS</title>
|
2014-04-05 00:24:19 +00:00
|
|
|
|
2017-03-18 16:35:37 +00:00
|
|
|
<script src="./scripts/StartAudioContext.js"></script>
|
|
|
|
<script src="./scripts/require.js"></script>
|
2015-06-27 21:25:01 +00:00
|
|
|
|
2017-03-18 16:35:37 +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-16 00:05:11 +00:00
|
|
|
|
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>
|
2017-03-18 16:35:37 +00:00
|
|
|
<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
|
|
|
});
|
2014-04-16 23:56:18 +00:00
|
|
|
|
2016-05-23 23:52:56 +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>
|
2017-03-18 16:35:37 +00:00
|
|
|
</html>
|