describing how to use the build with requirejs

This commit is contained in:
Yotam Mann 2014-10-02 13:40:19 -04:00
parent d1d155f58d
commit b2eebe9dc4

View file

@ -31,7 +31,7 @@ To get all of the files in their directory structure, you can ```npm install ton
```javascript
require.config({
baseUrl: './base',
baseUrl: "./base",
paths: {
"Tone" : "path/to/Tone.js/Tone"
}
@ -40,6 +40,18 @@ require(["Tone/core/Transport"], function(Transport){
//...
```
You can also use the [Tone.js Build](https://raw.githubusercontent.com/TONEnoTONE/Tone.js/master/build/Tone.js) with requirejs by adding the build as a dependency in require.config
```javascript
require.config({
deps : ["path/to/build/Tone"],
baseUrl: "./base",
});
//now pull in the modules individually by name
require(["Tone/instrument/Sampler"], function(Sampler){
//...
```
# AudioContext
Tone.js creates an AudioContext when it loads and shims it for maximum browser compatibility. The AudioContext can be found at ```Tone.context``` or from within any Object extending Tone as ```this.context```.