First release
This commit is contained in:
commit
fa6c85266e
2339 changed files with 761050 additions and 0 deletions
120
node_modules/quicklink/dist/react/hoc.js
generated
vendored
Normal file
120
node_modules/quicklink/dist/react/hoc.js
generated
vendored
Normal file
|
@ -0,0 +1,120 @@
|
|||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.withQuicklink = void 0;
|
||||
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _routeManifest = _interopRequireDefault(require("route-manifest"));
|
||||
|
||||
var _quicklink = require("./quicklink");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
var useIntersect = function useIntersect() {
|
||||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
||||
_ref$root = _ref.root,
|
||||
root = _ref$root === void 0 ? null : _ref$root,
|
||||
rootMargin = _ref.rootMargin,
|
||||
_ref$threshold = _ref.threshold,
|
||||
threshold = _ref$threshold === void 0 ? 0 : _ref$threshold;
|
||||
|
||||
var _useState = (0, _react.useState)({}),
|
||||
_useState2 = _slicedToArray(_useState, 2),
|
||||
entry = _useState2[0],
|
||||
updateEntry = _useState2[1];
|
||||
|
||||
var _useState3 = (0, _react.useState)(null),
|
||||
_useState4 = _slicedToArray(_useState3, 2),
|
||||
node = _useState4[0],
|
||||
setNode = _useState4[1];
|
||||
|
||||
var observer = (0, _react.useRef)(null);
|
||||
(0, _react.useEffect)(function () {
|
||||
if (observer.current) observer.current.disconnect();
|
||||
observer.current = new window.IntersectionObserver(function (_ref2) {
|
||||
var _ref3 = _slicedToArray(_ref2, 1),
|
||||
entry = _ref3[0];
|
||||
|
||||
return updateEntry(entry);
|
||||
}, {
|
||||
root: root,
|
||||
rootMargin: rootMargin,
|
||||
threshold: threshold
|
||||
});
|
||||
var currentObserver = observer.current;
|
||||
if (node) currentObserver.observe(node);
|
||||
return function () {
|
||||
return currentObserver.disconnect();
|
||||
};
|
||||
}, [node, root, rootMargin, threshold]);
|
||||
return [setNode, entry];
|
||||
};
|
||||
|
||||
var __defaultAccessor = function __defaultAccessor(mix) {
|
||||
return mix && mix.href || mix || '';
|
||||
};
|
||||
|
||||
var prefetchChunks = function prefetchChunks(entry, prefetchHandler) {
|
||||
var accessor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : __defaultAccessor;
|
||||
|
||||
var _rmanifest = (0, _routeManifest["default"])(window.__rmanifest, entry.pathname),
|
||||
files = _rmanifest.files;
|
||||
|
||||
var chunkURLs = files.map(accessor).filter(Boolean);
|
||||
|
||||
if (chunkURLs.length) {
|
||||
prefetchHandler(chunkURLs);
|
||||
} else {
|
||||
// also prefetch regular links in-viewport
|
||||
prefetchHandler(entry.href);
|
||||
}
|
||||
};
|
||||
|
||||
var withQuicklink = function withQuicklink(Component) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
return function (props) {
|
||||
var _useIntersect = useIntersect({
|
||||
root: document.body.parentElement
|
||||
}),
|
||||
_useIntersect2 = _slicedToArray(_useIntersect, 2),
|
||||
ref = _useIntersect2[0],
|
||||
entry = _useIntersect2[1];
|
||||
|
||||
var intersectionRatio = entry.intersectionRatio;
|
||||
(0, _react.useEffect)(function () {
|
||||
options.prefetchChunks = prefetchChunks;
|
||||
|
||||
if (intersectionRatio > 0) {
|
||||
(0, _quicklink.listen)(options);
|
||||
}
|
||||
}, [intersectionRatio]);
|
||||
return /*#__PURE__*/_react["default"].createElement("div", {
|
||||
ref: ref
|
||||
}, /*#__PURE__*/_react["default"].createElement(Component, props));
|
||||
};
|
||||
};
|
||||
|
||||
exports.withQuicklink = withQuicklink;
|
||||
|
||||
//# sourceMappingURL=hoc.js.map
|
1
node_modules/quicklink/dist/react/hoc.js.map
generated
vendored
Normal file
1
node_modules/quicklink/dist/react/hoc.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../src/react-chunks.js"],"names":[],"mappings":";;;;;;;;;AAgBA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,YAAY,GAAG,SAAf,YAAe,GAAqD;AAAA,iFAAP,EAAO;AAAA,uBAAlD,IAAkD;AAAA,MAAlD,IAAkD,0BAA3C,IAA2C;AAAA,MAArC,UAAqC,QAArC,UAAqC;AAAA,4BAAzB,SAAyB;AAAA,MAAzB,SAAyB,+BAAb,CAAa;;AAAA,kBAC3C,qBAAS,EAAT,CAD2C;AAAA;AAAA,MACjE,KADiE;AAAA,MAC1D,WAD0D;;AAAA,mBAEhD,qBAAS,IAAT,CAFgD;AAAA;AAAA,MAEjE,IAFiE;AAAA,MAE3D,OAF2D;;AAGxE,MAAM,QAAQ,GAAG,mBAAO,IAAP,CAAjB;AAEA,wBAAU,YAAM;AACd,QAAI,QAAQ,CAAC,OAAb,EAAsB,QAAQ,CAAC,OAAT,CAAiB,UAAjB;AACtB,IAAA,QAAQ,CAAC,OAAT,GAAmB,IAAI,MAAM,CAAC,oBAAX,CACjB;AAAA;AAAA,UAAE,KAAF;;AAAA,aAAa,WAAW,CAAC,KAAD,CAAxB;AAAA,KADiB,EAEjB;AACE,MAAA,IAAI,EAAJ,IADF;AAEE,MAAA,UAAU,EAAV,UAFF;AAGE,MAAA,SAAS,EAAT;AAHF,KAFiB,CAAnB;AAFc,QAWG,eAXH,GAWuB,QAXvB,CAWN,OAXM;AAYd,QAAI,IAAJ,EAAU,eAAe,CAAC,OAAhB,CAAwB,IAAxB;AAEV,WAAO;AAAA,aAAM,eAAe,CAAC,UAAhB,EAAN;AAAA,KAAP;AACD,GAfD,EAeG,CAAC,IAAD,EAAO,IAAP,EAAa,UAAb,EAAyB,SAAzB,CAfH;AAiBA,SAAO,CAAC,OAAD,EAAU,KAAV,CAAP;AACD,CAvBD;;AAyBA,IAAM,iBAAiB,GAAG,SAApB,iBAAoB,CAAA,GAAG,EAAI;AAC/B,SAAQ,GAAG,IAAI,GAAG,CAAC,IAAZ,IAAqB,GAArB,IAA4B,EAAnC;AACD,CAFD;;AAIA,IAAM,cAAc,GAAG,SAAjB,cAAiB,CAAC,KAAD,EAAQ,eAAR,EAA0D;AAAA,MAAjC,QAAiC,uEAAtB,iBAAsB;;AAAA,mBAC7D,+BAAU,MAAM,CAAC,WAAjB,EAA8B,KAAK,CAAC,QAApC,CAD6D;AAAA,MACvE,KADuE,cACvE,KADuE;;AAE/E,MAAM,SAAS,GAAG,KAAK,CAAC,GAAN,CAAU,QAAV,EAAoB,MAApB,CAA2B,OAA3B,CAAlB;;AACA,MAAI,SAAS,CAAC,MAAd,EAAsB;AACpB,IAAA,eAAe,CAAC,SAAD,CAAf;AACD,GAFD,MAEO;AACL;AACA,IAAA,eAAe,CAAC,KAAK,CAAC,IAAP,CAAf;AACD;AACF,CATD;;AAWA,IAAM,aAAa,GAAG,SAAhB,aAAgB,CAAC,SAAD,EAA6B;AAAA,MAAjB,OAAiB,uEAAP,EAAO;AACjD,SAAO,UAAA,KAAK,EAAI;AAAA,wBACK,YAAY,CAAC;AAAC,MAAA,IAAI,EAAE,QAAQ,CAAC,IAAT,CAAc;AAArB,KAAD,CADjB;AAAA;AAAA,QACT,GADS;AAAA,QACJ,KADI;;AAEd,QAAM,iBAAiB,GAAG,KAAK,CAAC,iBAAhC;AAEF,0BAAU,YAAM;AACZ,MAAA,OAAO,CAAC,cAAR,GAAyB,cAAzB;;AAEA,UAAI,iBAAiB,GAAG,CAAxB,EAA2B;AACzB,+BAAO,OAAP;AACD;AACF,KANH,EAMK,CAAC,iBAAD,CANL;AAQA,wBACC;AAAK,MAAA,GAAG,EAAE;AAAV,oBACK,gCAAC,SAAD,EAAe,KAAf,CADL,CADD;AAKA,GAjBA;AAkBD,CAnBD","file":"hoc.js","sourcesContent":["/*\n * Copyright 2019-2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport rmanifest from 'route-manifest';\nimport { listen } from './quicklink';\n\nconst useIntersect = ({ root = null, rootMargin, threshold = 0 } = {}) => {\n const [entry, updateEntry] = useState({});\n const [node, setNode] = useState(null);\n const observer = useRef(null);\n\n useEffect(() => {\n if (observer.current) observer.current.disconnect();\n observer.current = new window.IntersectionObserver(\n ([entry]) => updateEntry(entry),\n {\n root,\n rootMargin,\n threshold\n }\n );\n\n const { current: currentObserver } = observer;\n if (node) currentObserver.observe(node);\n\n return () => currentObserver.disconnect();\n }, [node, root, rootMargin, threshold]);\n\n return [setNode, entry];\n};\n\nconst __defaultAccessor = mix => {\n return (mix && mix.href) || mix || '';\n};\n\nconst prefetchChunks = (entry, prefetchHandler, accessor = __defaultAccessor) => {\n const { files } = rmanifest(window.__rmanifest, entry.pathname);\n const chunkURLs = files.map(accessor).filter(Boolean);\n if (chunkURLs.length) {\n prefetchHandler(chunkURLs);\n } else {\n // also prefetch regular links in-viewport\n prefetchHandler(entry.href);\n }\n};\n\nconst withQuicklink = (Component, options = {}) => {\n return props => {\n\t\tconst [ref, entry] = useIntersect({root: document.body.parentElement});\n const intersectionRatio = entry.intersectionRatio;\n \n\t\tuseEffect(() => {\n options.prefetchChunks = prefetchChunks;\n\n if (intersectionRatio > 0) {\n listen(options);\n }\n }, [intersectionRatio]); \n\t\t\n\t\treturn (\n\t\t\t<div ref={ref}>\n <Component {...props} />\n\t\t\t</div>\n\t\t);\n\t};\n};\n\nexport {\n withQuicklink\n};\n"]}
|
1
node_modules/quicklink/dist/react/quicklink.js
generated
vendored
Normal file
1
node_modules/quicklink/dist/react/quicklink.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
function e(e){return new Promise(function(n,t,r){(r=new XMLHttpRequest).open("GET",e,r.withCredentials=!0),r.onload=function(){200===r.status?n():t()},r.send()})}var n,t=(n=document.createElement("link")).relList&&n.relList.supports&&n.relList.supports("prefetch")?function(e){return new Promise(function(n,t,r){(r=document.createElement("link")).rel="prefetch",r.href=e,r.onload=n,r.onerror=t,document.head.appendChild(r)})}:e,r=window.requestIdleCallback||function(e){var n=Date.now();return setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-n))}})},1)},o=new Set;function i(n,r,i){if(i=navigator.connection){if(i.saveData)return Promise.reject(new Error("Cannot prefetch, Save-Data is enabled"));if(/2g/.test(i.effectiveType))return Promise.reject(new Error("Cannot prefetch, network conditions are poor"))}return Promise.all([].concat(n).map(function(n){if(!o.has(n))return o.add(n),(r?function(n){return window.fetch?fetch(n,{credentials:"include"}):e(n)}:t)(new URL(n,location.href).toString())}))}exports.listen=function(e){if(e||(e={}),window.IntersectionObserver){var n=function(e){e=e||1;var n=[],t=0;function r(){t<e&&n.length>0&&(n.shift()(),t++)}return[function(e){n.push(e)>1||r()},function(){t--,r()}]}(e.throttle||1/0),t=n[0],c=n[1],u=e.limit||1/0,a=e.origins||[location.hostname],s=e.ignores||[],f=e.timeoutFn||r,l=e.prefetchChunks,h=function(n){i(n,e.priority).then(c).catch(function(n){c(),e.onError&&e.onError(n)})},d=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&(d.unobserve(e=e.target),o.size<u&&t(function(){l?l(e,h):h(e.href)}))})});return f(function(){(e.el||document).querySelectorAll("a").forEach(function(e){a.length&&!a.includes(e.hostname)||function e(n,t){return Array.isArray(t)?t.some(function(t){return e(n,t)}):(t.test||t).call(t,n.href,n)}(e,s)||d.observe(e)})},{timeout:e.timeout||2e3}),function(){o.clear(),d.disconnect()}}},exports.prefetch=i;
|
1
node_modules/quicklink/dist/react/quicklink.mjs
generated
vendored
Normal file
1
node_modules/quicklink/dist/react/quicklink.mjs
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
function e(e){return new Promise(function(n,t,r){(r=new XMLHttpRequest).open("GET",e,r.withCredentials=!0),r.onload=function(){200===r.status?n():t()},r.send()})}var n,t=(n=document.createElement("link")).relList&&n.relList.supports&&n.relList.supports("prefetch")?function(e){return new Promise(function(n,t,r){(r=document.createElement("link")).rel="prefetch",r.href=e,r.onload=n,r.onerror=t,document.head.appendChild(r)})}:e,r=window.requestIdleCallback||function(e){var n=Date.now();return setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-n))}})},1)},o=new Set;function i(e){if(e||(e={}),window.IntersectionObserver){var n=function(e){e=e||1;var n=[],t=0;function r(){t<e&&n.length>0&&(n.shift()(),t++)}return[function(e){n.push(e)>1||r()},function(){t--,r()}]}(e.throttle||1/0),t=n[0],i=n[1],u=e.limit||1/0,a=e.origins||[location.hostname],f=e.ignores||[],s=e.timeoutFn||r,l=e.prefetchChunks,h=function(n){c(n,e.priority).then(i).catch(function(n){i(),e.onError&&e.onError(n)})},d=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&(d.unobserve(e=e.target),o.size<u&&t(function(){l?l(e,h):h(e.href)}))})});return s(function(){(e.el||document).querySelectorAll("a").forEach(function(e){a.length&&!a.includes(e.hostname)||function e(n,t){return Array.isArray(t)?t.some(function(t){return e(n,t)}):(t.test||t).call(t,n.href,n)}(e,f)||d.observe(e)})},{timeout:e.timeout||2e3}),function(){o.clear(),d.disconnect()}}}function c(n,r,i){if(i=navigator.connection){if(i.saveData)return Promise.reject(new Error("Cannot prefetch, Save-Data is enabled"));if(/2g/.test(i.effectiveType))return Promise.reject(new Error("Cannot prefetch, network conditions are poor"))}return Promise.all([].concat(n).map(function(n){if(!o.has(n))return o.add(n),(r?function(n){return window.fetch?fetch(n,{credentials:"include"}):e(n)}:t)(new URL(n,location.href).toString())}))}export{i as listen,c as prefetch};
|
1
node_modules/quicklink/dist/react/quicklink.modern.js
generated
vendored
Normal file
1
node_modules/quicklink/dist/react/quicklink.modern.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
function e(e){return new Promise((t,n,r)=>{(r=new XMLHttpRequest).open("GET",e,r.withCredentials=!0),r.onload=()=>{200===r.status?t():n()},r.send()})}function t(t){return window.fetch?fetch(t,{credentials:"include"}):e(t)}const n=(r=document.createElement("link")).relList&&r.relList.supports&&r.relList.supports("prefetch")?function(e){return new Promise((t,n,r)=>{(r=document.createElement("link")).rel="prefetch",r.href=e,r.onload=t,r.onerror=n,document.head.appendChild(r)})}:e;var r;const o=window.requestIdleCallback||function(e){const t=Date.now();return setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})},1)},i=new Set;function c(e){if(e||(e={}),!window.IntersectionObserver)return;const[t,n]=function(e){e=e||1;var t=[],n=0;function r(){n<e&&t.length>0&&(t.shift()(),n++)}return[function(e){t.push(e)>1||r()},function(){n--,r()}]}(e.throttle||1/0),r=e.limit||1/0,c=e.origins||[location.hostname],a=e.ignores||[],u=e.timeoutFn||o,f=e.prefetchChunks,l=t=>{s(t,e.priority).then(n).catch(t=>{n(),e.onError&&e.onError(t)})},h=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&(h.unobserve(e=e.target),i.size<r&&t(()=>{f?f(e,l):l(e.href)}))})});return u(()=>{(e.el||document).querySelectorAll("a").forEach(e=>{c.length&&!c.includes(e.hostname)||function e(t,n){return Array.isArray(n)?n.some(n=>e(t,n)):(n.test||n).call(n,t.href,t)}(e,a)||h.observe(e)})},{timeout:e.timeout||2e3}),function(){i.clear(),h.disconnect()}}function s(e,r,o){if(o=navigator.connection){if(o.saveData)return Promise.reject(new Error("Cannot prefetch, Save-Data is enabled"));if(/2g/.test(o.effectiveType))return Promise.reject(new Error("Cannot prefetch, network conditions are poor"))}return Promise.all([].concat(e).map(e=>{if(!i.has(e))return i.add(e),(r?t:n)(new URL(e,location.href).toString())}))}export{c as listen,s as prefetch};
|
1
node_modules/quicklink/dist/react/quicklink.umd.js
generated
vendored
Normal file
1
node_modules/quicklink/dist/react/quicklink.umd.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.quicklink={})}(this,function(e){function n(e){return new Promise(function(n,t,r){(r=new XMLHttpRequest).open("GET",e,r.withCredentials=!0),r.onload=function(){200===r.status?n():t()},r.send()})}var t,r=(t=document.createElement("link")).relList&&t.relList.supports&&t.relList.supports("prefetch")?function(e){return new Promise(function(n,t,r){(r=document.createElement("link")).rel="prefetch",r.href=e,r.onload=n,r.onerror=t,document.head.appendChild(r)})}:n,o=window.requestIdleCallback||function(e){var n=Date.now();return setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-n))}})},1)},i=new Set;function c(e,t,o){if(o=navigator.connection){if(o.saveData)return Promise.reject(new Error("Cannot prefetch, Save-Data is enabled"));if(/2g/.test(o.effectiveType))return Promise.reject(new Error("Cannot prefetch, network conditions are poor"))}return Promise.all([].concat(e).map(function(e){if(!i.has(e))return i.add(e),(t?function(e){return window.fetch?fetch(e,{credentials:"include"}):n(e)}:r)(new URL(e,location.href).toString())}))}e.listen=function(e){if(e||(e={}),window.IntersectionObserver){var n=function(e){e=e||1;var n=[],t=0;function r(){t<e&&n.length>0&&(n.shift()(),t++)}return[function(e){n.push(e)>1||r()},function(){t--,r()}]}(e.throttle||1/0),t=n[0],r=n[1],u=e.limit||1/0,f=e.origins||[location.hostname],a=e.ignores||[],s=e.timeoutFn||o,l=e.prefetchChunks,d=function(n){c(n,e.priority).then(r).catch(function(n){r(),e.onError&&e.onError(n)})},h=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&(h.unobserve(e=e.target),i.size<u&&t(function(){l?l(e,d):d(e.href)}))})});return s(function(){(e.el||document).querySelectorAll("a").forEach(function(e){f.length&&!f.includes(e.hostname)||function e(n,t){return Array.isArray(t)?t.some(function(t){return e(n,t)}):(t.test||t).call(t,n.href,n)}(e,a)||h.observe(e)})},{timeout:e.timeout||2e3}),function(){i.clear(),h.disconnect()}}},e.prefetch=c});
|
Loading…
Add table
Add a link
Reference in a new issue