Comparing version 0.0.3 to 0.0.4
@@ -9,3 +9,3 @@ module.exports = { | ||
sourceType: 'module', | ||
ecmaVersion: 8 | ||
ecmaVersion: 9 | ||
}, | ||
@@ -12,0 +12,0 @@ extends: 'google', |
@@ -1,1 +0,1 @@ | ||
var n={};function t(n){return new Promise(function(t,e){var o=new XMLHttpRequest;o.open("GET",n,!0),o.withCredentials=!0,o.onload=function(){200===o.status?t():e()},o.send(null)})}var e=function(n){if("undefined"==typeof document)return!1;var t=document.createElement("link");try{if(t.relList&&"function"==typeof t.relList.supports)return t.relList.supports(n)}catch(n){return!1}}("prefetch")?function(n){return new Promise(function(t,e){if("undefined"!=typeof document){var o=document.createElement("link");o.setAttribute("rel","prefetch"),o.setAttribute("href",n),o.onload=t,o.onerror=e,(document.getElementsByTagName("head")[0]||document.getElementsByName("script")[0].parentNode).appendChild(o)}else e()})}:t;function o(o,i){return new Promise(function(r){if("connection"in navigator){if(navigator.connection.effectiveType&&/\slow-2g|2g/.test(navigator.connection.effectiveType))return void r();if(navigator.connection.saveData)return void r()}n[o]?r():i&&"high"===i?function(n){return new Promise(function(e,o){void 0===self.fetch?t(n).then(function(){e()}):fetch(n,{credentials:"include"}).then(function(){e()})})}(o).then(function(){r(),n[o]=!0}).catch(function(){}):e(o).then(function(){r(),n[o]=!0}).catch(function(){})})}var i=i||function(n){var t=Date.now();return setTimeout(function(){n({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})},1)};var r=function(n,t){n.forEach(function(n){o(n,t)})};module.exports=function(n){return new Promise(function(t,e){((n=n||{priority:"low",timeout:2e3}).timeoutFn||i)(function(){void 0!==n.urls&&n.urls.length>0?(r(n.urls,n.priority),t(n.urls)):function(n){return new Promise(function(t,e){var o=[],i=n.querySelectorAll("a"),r=new IntersectionObserver(function(n){n.forEach(function(n){n.intersectionRatio>0&&o.push(n.target.href)}),t(o)});i.forEach(function(n){r.observe(n)})})}(n.el||document).then(function(e){r(e,n.priority),t(e)})},{timeout:n.timeout})})}; | ||
var t={};function e(t){return new Promise(function(e,n){var r=new XMLHttpRequest;r.open("GET",t,!0),r.withCredentials=!0,r.onload=function(){200===r.status?e():n()},r.send(null)})}var n=function(t){if("undefined"==typeof document)return!1;var e=document.createElement("link");try{if(e.relList&&"function"==typeof e.relList.supports)return e.relList.supports(t)}catch(t){return!1}}("prefetch")?function(t){return new Promise(function(e,n){if("undefined"!=typeof document){var r=document.createElement("link");r.setAttribute("rel","prefetch"),r.setAttribute("href",t),r.onload=e,r.onerror=n,(document.getElementsByTagName("head")[0]||document.getElementsByName("script")[0].parentNode).appendChild(r)}else n()})}:e;function r(r,i){return new Promise(function(o,u){if(t[r])return o();if("connection"in navigator){if((navigator.connection.effectiveType||"").includes("2g"))return o();if(navigator.connection.saveData)return o()}var c=function(){try{return o()}catch(t){return u(t)}},a=function(t){try{return c()}catch(t){return u(t)}};try{return i&&"high"===i?function(t){return void 0===self.fetch?e(t):fetch(t,{credentials:"include"})}(r).then(function(t){try{return f.call(this)}catch(t){return a()}}.bind(this),a):n(r).then(function(t){try{return f.call(this)}catch(t){return a()}}.bind(this),a);function f(){return t[r]=!0,c()}}catch(t){a()}})}var i=i||function(t){var e=Date.now();return setTimeout(function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)},o=new Map,u=new IntersectionObserver(function(t){t.filter(function(t){return t.isIntersecting}).forEach(function(t){var e=t.target.href;o.has(e)&&o.get(e).call(null)})});module.exports=function(t){(t=Object.assign({},{priority:"low",timeout:2e3,timeoutFn:i,el:document},t)).timeoutFn(function(){if(t.urls)t.urls.forEach(function(e){return r(e,t.priority)});else{var e=Array.from(t.el.querySelectorAll("a"));e.forEach(function(t){return u.observe(t)}),e.map(function(t){return t.href}).forEach(function(e){o.set(e,function(){o.delete(e),r(e,t.priority)})})}},{timeout:t.timeout})}; |
@@ -1,1 +0,1 @@ | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):n.quicklink=e()}(this,function(){var n={};function e(n){return new Promise(function(e,t){var o=new XMLHttpRequest;o.open("GET",n,!0),o.withCredentials=!0,o.onload=function(){200===o.status?e():t()},o.send(null)})}var t=function(n){if("undefined"==typeof document)return!1;var e=document.createElement("link");try{if(e.relList&&"function"==typeof e.relList.supports)return e.relList.supports(n)}catch(n){return!1}}("prefetch")?function(n){return new Promise(function(e,t){if("undefined"!=typeof document){var o=document.createElement("link");o.setAttribute("rel","prefetch"),o.setAttribute("href",n),o.onload=e,o.onerror=t,(document.getElementsByTagName("head")[0]||document.getElementsByName("script")[0].parentNode).appendChild(o)}else t()})}:e;function o(o,i){return new Promise(function(r){if("connection"in navigator){if(navigator.connection.effectiveType&&/\slow-2g|2g/.test(navigator.connection.effectiveType))return void r();if(navigator.connection.saveData)return void r()}n[o]?r():i&&"high"===i?function(n){return new Promise(function(t,o){void 0===self.fetch?e(n).then(function(){t()}):fetch(n,{credentials:"include"}).then(function(){t()})})}(o).then(function(){r(),n[o]=!0}).catch(function(){}):t(o).then(function(){r(),n[o]=!0}).catch(function(){})})}var i=i||function(n){var e=Date.now();return setTimeout(function(){n({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)};var r=function(n,e){n.forEach(function(n){o(n,e)})};return function(n){return new Promise(function(e,t){((n=n||{priority:"low",timeout:2e3}).timeoutFn||i)(function(){void 0!==n.urls&&n.urls.length>0?(r(n.urls,n.priority),e(n.urls)):function(n){return new Promise(function(e,t){var o=[],i=n.querySelectorAll("a"),r=new IntersectionObserver(function(n){n.forEach(function(n){n.intersectionRatio>0&&o.push(n.target.href)}),e(o)});i.forEach(function(n){r.observe(n)})})}(n.el||document).then(function(t){r(t,n.priority),e(t)})},{timeout:n.timeout})})}}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.quicklink=e()}(this,function(){var t={};function e(t){return new Promise(function(e,n){var r=new XMLHttpRequest;r.open("GET",t,!0),r.withCredentials=!0,r.onload=function(){200===r.status?e():n()},r.send(null)})}var n=function(t){if("undefined"==typeof document)return!1;var e=document.createElement("link");try{if(e.relList&&"function"==typeof e.relList.supports)return e.relList.supports(t)}catch(t){return!1}}("prefetch")?function(t){return new Promise(function(e,n){if("undefined"!=typeof document){var r=document.createElement("link");r.setAttribute("rel","prefetch"),r.setAttribute("href",t),r.onload=e,r.onerror=n,(document.getElementsByTagName("head")[0]||document.getElementsByName("script")[0].parentNode).appendChild(r)}else n()})}:e;function r(r,i){return new Promise(function(o,u){if(t[r])return o();if("connection"in navigator){if((navigator.connection.effectiveType||"").includes("2g"))return o();if(navigator.connection.saveData)return o()}var c=function(){try{return o()}catch(t){return u(t)}},f=function(t){try{return c()}catch(t){return u(t)}};try{return i&&"high"===i?function(t){return void 0===self.fetch?e(t):fetch(t,{credentials:"include"})}(r).then(function(t){try{return a.call(this)}catch(t){return f()}}.bind(this),f):n(r).then(function(t){try{return a.call(this)}catch(t){return f()}}.bind(this),f);function a(){return t[r]=!0,c()}}catch(t){f()}})}var i=i||function(t){var e=Date.now();return setTimeout(function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)},o=new Map,u=new IntersectionObserver(function(t){t.filter(function(t){return t.isIntersecting}).forEach(function(t){var e=t.target.href;o.has(e)&&o.get(e).call(null)})});return function(t){(t=Object.assign({},{priority:"low",timeout:2e3,timeoutFn:i,el:document},t)).timeoutFn(function(){if(t.urls)t.urls.forEach(function(e){return r(e,t.priority)});else{var e=Array.from(t.el.querySelectorAll("a"));e.forEach(function(t){return u.observe(t)}),e.map(function(t){return t.href}).forEach(function(e){o.set(e,function(){o.delete(e),r(e,t.priority)})})}},{timeout:t.timeout})}}); |
{ | ||
"name": "quicklink", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Faster subsequent page-loads by prefetching in-viewport links during idle time", | ||
@@ -5,0 +5,0 @@ "main": "dist/quicklink.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
222406
400