Skip to content

Commit 7d5363d

Browse files
committed
Task: Add latest build and package.lock
1 parent 984ba9f commit 7d5363d

File tree

3 files changed

+5468
-24
lines changed

3 files changed

+5468
-24
lines changed

build/beet.js

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ var notes = {
220220
};
221221

222222
function mtof(midi_note) {
223-
console.log();
224223
return Math.pow(2, (midi_note - 69) / 12) * 440;
225224
}
226225

@@ -240,12 +239,13 @@ module.exports.envelope = function (audioParam, now, opts) {
240239
audioParam.linearRampToValueAtTime(0, now + attack + decay + release);
241240
};
242241

243-
module.exports.load = function (path, success, failure) {
242+
module.exports.load = function(path, success, failure, providedContext) {
244243
var request = new XMLHttpRequest();
245-
request.open('GET', path, true);
246-
request.responseType = 'arraybuffer';
247-
request.onload = function () {
248-
context.decodeAudioData(request.response, success, failure);
244+
var audioContext = providedContext ? providedContext : context;
245+
request.open("GET", path, true);
246+
request.responseType = "arraybuffer";
247+
request.onload = function() {
248+
audioContext.decodeAudioData(request.response, success, failure);
249249
};
250250
request.onerror = failure;
251251
request.send();
@@ -13122,8 +13122,7 @@ var cache = arguments[5];
1312213122

1312313123
var stringify = JSON.stringify;
1312413124

13125-
module.exports = function (fn) {
13126-
var keys = [];
13125+
module.exports = function (fn, options) {
1312713126
var wkey;
1312813127
var cacheKeys = Object.keys(cache);
1312913128

@@ -13134,7 +13133,7 @@ module.exports = function (fn) {
1313413133
// be an object with the default export as a property of it. To ensure
1313513134
// the existing api and babel esmodule exports are both supported we
1313613135
// check for both
13137-
if (exp === fn || exp.default === fn) {
13136+
if (exp === fn || exp && exp.default === fn) {
1313813137
wkey = key;
1313913138
break;
1314013139
}
@@ -13148,25 +13147,38 @@ module.exports = function (fn) {
1314813147
wcache[key] = key;
1314913148
}
1315013149
sources[wkey] = [
13151-
Function(['require','module','exports'], '(' + fn + ')(self)'),
13150+
'function(require,module,exports){' + fn + '(self); }',
1315213151
wcache
1315313152
];
1315413153
}
1315513154
var skey = Math.floor(Math.pow(16, 8) * Math.random()).toString(16);
1315613155

1315713156
var scache = {}; scache[wkey] = wkey;
1315813157
sources[skey] = [
13159-
Function(['require'], (
13160-
// try to call default if defined to also support babel esmodule
13161-
// exports
13158+
'function(require,module,exports){' +
13159+
// try to call default if defined to also support babel esmodule exports
1316213160
'var f = require(' + stringify(wkey) + ');' +
13163-
'(f.default ? f.default : f)(self);'
13164-
)),
13161+
'(f.default ? f.default : f)(self);' +
13162+
'}',
1316513163
scache
1316613164
];
1316713165

13166+
var workerSources = {};
13167+
resolveSources(skey);
13168+
13169+
function resolveSources(key) {
13170+
workerSources[key] = true;
13171+
13172+
for (var depPath in sources[key][1]) {
13173+
var depKey = sources[key][1][depPath];
13174+
if (!workerSources[depKey]) {
13175+
resolveSources(depKey);
13176+
}
13177+
}
13178+
}
13179+
1316813180
var src = '(' + bundleFn + ')({'
13169-
+ Object.keys(sources).map(function (key) {
13181+
+ Object.keys(workerSources).map(function (key) {
1317013182
return stringify(key) + ':['
1317113183
+ sources[key][0]
1317213184
+ ',' + stringify(sources[key][1]) + ']'
@@ -13177,10 +13189,13 @@ module.exports = function (fn) {
1317713189

1317813190
var URL = window.URL || window.webkitURL || window.mozURL || window.msURL;
1317913191

13180-
return new Worker(URL.createObjectURL(
13181-
new Blob([src], { type: 'text/javascript' })
13182-
));
13192+
var blob = new Blob([src], { type: 'text/javascript' });
13193+
if (options && options.bare) { return blob; }
13194+
var workerUrl = URL.createObjectURL(blob);
13195+
var worker = new Worker(workerUrl);
13196+
worker.objectURL = workerUrl;
13197+
return worker;
1318313198
};
1318413199

1318513200
},{}]},{},[1])(1)
13186-
});
13201+
});

0 commit comments

Comments
 (0)