Comparing version 0.2.0 to 0.2.1
{ | ||
"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); | ||
} | ||
} | ||
``` |
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
11036
169