26 lines
810 B
JavaScript
26 lines
810 B
JavaScript
define(["exports"], function (_exports) {
|
|
function download(url) {
|
|
var a = document.createElement("a");
|
|
(a.download = ""), (a.href = url), a.dispatchEvent(new MouseEvent("click"));
|
|
}
|
|
Object.defineProperty(_exports, "__esModule", { value: !0 }),
|
|
(_exports.default = function (urls) {
|
|
if (!urls) throw new Error("`urls` required");
|
|
var delay = 0;
|
|
urls.forEach(function (url) {
|
|
if (
|
|
!(function (url) {
|
|
var a = document.createElement("a");
|
|
return (
|
|
(a.href = url),
|
|
location.hostname === a.hostname &&
|
|
location.protocol === a.protocol
|
|
);
|
|
})(url)
|
|
)
|
|
return setTimeout(download.bind(null, url), 100 * ++delay);
|
|
download(url);
|
|
});
|
|
});
|
|
});
|