mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-08 01:48:53 +00:00
666d8f96c1
gets rid of the problem of having the global ‘define’ left defined in the window which may have adverse effects on other AMD shim modules.
19 lines
540 B
JavaScript
19 lines
540 B
JavaScript
(function (root) {
|
|
//AMD shim for the presets build
|
|
if (typeof define !== "function" &&
|
|
typeof root.Tone === "function") {
|
|
//define 'define' to invoke the callbacks with Tone
|
|
root.ToneDefinedDefine = true;
|
|
root.define = function(){
|
|
//the last argument is the callback
|
|
var lastArg = arguments[arguments.length - 1];
|
|
//the first argument is the dependencies or name
|
|
if (typeof lastArg === "function"){
|
|
//if it's not the root, pass in the root
|
|
//as the parameter
|
|
lastArg(root.Tone);
|
|
}
|
|
};
|
|
}
|
|
} (this));
|
|
|