webamp 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,11 +2,12 @@
2
2
 
3
3
  _No changes yet._
4
4
 
5
- ## 2.1.1 [CURRENT]
5
+ ## 2.1.2 [CURRENT]
6
6
 
7
7
  ### Bug Fixes
8
8
 
9
9
  - Avoid opening Milkdrop window when no window layout is provided.
10
+ - Work around issue where setImmediate was not accessible to JSZip when parsing skins.
10
11
 
11
12
  ## 2.1.0
12
13
 
@@ -0,0 +1 @@
1
+ export declare function setImmediate(callback: Function): number;
@@ -0,0 +1 @@
1
+ export declare function setImmediate(callback: Function): number;
@@ -0,0 +1 @@
1
+ export declare function setImmediate(callback: Function): number;
@@ -44367,6 +44367,125 @@
44367
44367
  // @ts-ignore
44368
44368
  window.Webamp = Webamp$1;
44369
44369
 
44370
+ // A Fork of the NPM module `setimmediate`
44371
+ // I've adapted this to only include the browser implementation and to not
44372
+ // mutate the global object and instead export the `setImmediate` function.
44373
+ let nextHandle = 1; // Spec says greater than zero
44374
+ const tasksByHandle = {};
44375
+ let currentlyRunningATask = false;
44376
+ let registerImmediate;
44377
+ function setImmediate$1(callback) {
44378
+ // Copy function arguments
44379
+ const args = new Array(arguments.length - 1);
44380
+ for (let i = 0; i < args.length; i++) {
44381
+ args[i] = arguments[i + 1];
44382
+ }
44383
+ // Store and register the task
44384
+ const task = { callback: callback, args: args };
44385
+ tasksByHandle[nextHandle] = task;
44386
+ registerImmediate(nextHandle);
44387
+ return nextHandle++;
44388
+ }
44389
+ function clearImmediate(handle) {
44390
+ delete tasksByHandle[handle];
44391
+ }
44392
+ function run(task) {
44393
+ const callback = task.callback;
44394
+ const args = task.args;
44395
+ switch (args.length) {
44396
+ case 0:
44397
+ callback();
44398
+ break;
44399
+ case 1:
44400
+ callback(args[0]);
44401
+ break;
44402
+ case 2:
44403
+ callback(args[0], args[1]);
44404
+ break;
44405
+ case 3:
44406
+ callback(args[0], args[1], args[2]);
44407
+ break;
44408
+ default:
44409
+ // eslint-disable-next-line prefer-spread
44410
+ callback.apply(undefined, args);
44411
+ break;
44412
+ }
44413
+ }
44414
+ function runIfPresent(handle) {
44415
+ // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
44416
+ // So if we're currently running a task, we'll need to delay this invocation.
44417
+ if (currentlyRunningATask) {
44418
+ // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
44419
+ // "too much recursion" error.
44420
+ setTimeout(runIfPresent, 0, handle);
44421
+ }
44422
+ else {
44423
+ const task = tasksByHandle[handle];
44424
+ if (task) {
44425
+ currentlyRunningATask = true;
44426
+ try {
44427
+ run(task);
44428
+ }
44429
+ finally {
44430
+ clearImmediate(handle);
44431
+ currentlyRunningATask = false;
44432
+ }
44433
+ }
44434
+ }
44435
+ }
44436
+ function canUsePostMessage() {
44437
+ // The test against `importScripts` prevents this implementation from being installed inside a web worker,
44438
+ // where `global.postMessage` means something completely different and can't be used for this purpose.
44439
+ if (!window.importScripts) {
44440
+ let postMessageIsAsynchronous = true;
44441
+ const oldOnMessage = window.onmessage;
44442
+ window.onmessage = function () {
44443
+ postMessageIsAsynchronous = false;
44444
+ };
44445
+ window.postMessage("", "*");
44446
+ window.onmessage = oldOnMessage;
44447
+ return postMessageIsAsynchronous;
44448
+ }
44449
+ }
44450
+ function installPostMessageImplementation() {
44451
+ // Installs an event handler on `global` for the `message` event: see
44452
+ // * https://developer.mozilla.org/en/DOM/window.postMessage
44453
+ // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
44454
+ const messagePrefix = `setImmediate$${Math.random()}$`;
44455
+ window.addEventListener("message", (event) => {
44456
+ if (event.source === window &&
44457
+ typeof event.data === "string" &&
44458
+ event.data.indexOf(messagePrefix) === 0) {
44459
+ runIfPresent(+event.data.slice(messagePrefix.length));
44460
+ }
44461
+ }, false);
44462
+ registerImmediate = function (handle) {
44463
+ window.postMessage(messagePrefix + handle, "*");
44464
+ };
44465
+ }
44466
+ function installSetTimeoutImplementation() {
44467
+ registerImmediate = function (handle) {
44468
+ setTimeout(runIfPresent, 0, handle);
44469
+ };
44470
+ }
44471
+ if (canUsePostMessage()) {
44472
+ // For non-IE10 modern browsers
44473
+ installPostMessageImplementation();
44474
+ }
44475
+ else {
44476
+ // For older browsers
44477
+ installSetTimeoutImplementation();
44478
+ }
44479
+
44480
+ var utilsExports = requireUtils();
44481
+ var Utils = /*@__PURE__*/getDefaultExportFromCjs(utilsExports);
44482
+
44483
+ // @ts-ignore
44484
+ Utils.delay = function (callback, args, self) {
44485
+ setImmediate$1(() => {
44486
+ callback.apply(self || null, args || []);
44487
+ });
44488
+ };
44370
44489
  class Webamp extends Webamp$1 {
44371
44490
  constructor(options) {
44372
44491
  super({