Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prefetch

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prefetch - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

package.json
{
"name": "prefetch",
"version": "0.2.0",
"version": "0.2.1",
"description": "Customizable interaction-based link prefetching.",

@@ -5,0 +5,0 @@ "main": "prefetch.js",

@@ -141,3 +141,5 @@ /**

var a = getLinkTarget(e.target);
execute(a);
if(a && isPrefetchable(a)){
execute(a);
}
}

@@ -148,3 +150,5 @@

var a = getLinkTarget(e.target);
execute(a);
if(a && isPrefetchable(a)){
execute(a);
}
}

@@ -151,0 +155,0 @@

@@ -104,9 +104,9 @@ # prefetch

The `callback` param must be a function and it accepts up to three parameters. In the exampmle below, the callback function evaluates the href's URL and, based on the presence of some identifier, decides whether to execute an ajax call or procede with the normal `prefetch` behavior.
The `callback` param must be a function and it accepts up to three parameters. In the example below, the callback function evaluates the href's URL and, based on the presence of some identifier, decides whether to execute an ajax call or procede with the normal `prefetch` behavior.
```javascript
function handlePrefetch(url, anchor, fetch){
function handlePrefetch(url, anchor, injectPrefetchLink){
//url: the string from the href attribute of the anchor tag over which the user's cursor hovered
//anchor: the <a> tag over which the user's cursor hovered
//fetch: the function that prefetch internally executes to inject a prefetch link
//injectPrefetchLink: the function that prefetch internally executes to inject a prefetch link

@@ -116,5 +116,5 @@ if(url.indexOf('some-identifier') > 0){

} else {
fetch(url);
injectPrefetchLink(url);
}
}
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc