mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 08:38:00 +00:00
baseUrl
useful for various production environments.
This commit is contained in:
parent
93d70a3a9e
commit
12c7426f53
1 changed files with 8 additions and 1 deletions
|
@ -317,6 +317,13 @@ define(["Tone/core/Tone", "Tone/core/Emitter"], function(Tone){
|
|||
Tone.Buffer.trigger("progress", completed / Tone.Buffer._totalDownloads);
|
||||
};
|
||||
|
||||
/**
|
||||
* A path which is prefixed before every url.
|
||||
* @type {String}
|
||||
* @static
|
||||
*/
|
||||
Tone.Buffer.baseUrl = "";
|
||||
|
||||
/**
|
||||
* Makes an xhr reqest for the selected url then decodes
|
||||
* the file as an audio buffer. Invokes
|
||||
|
@ -329,7 +336,7 @@ define(["Tone/core/Tone", "Tone/core/Emitter"], function(Tone){
|
|||
*/
|
||||
Tone.Buffer.load = function(url, callback){
|
||||
var request = new XMLHttpRequest();
|
||||
request.open("GET", url, true);
|
||||
request.open("GET", Tone.Buffer.baseUrl + url, true);
|
||||
request.responseType = "arraybuffer";
|
||||
// decode asynchronously
|
||||
request.onload = function() {
|
||||
|
|
Loading…
Reference in a new issue