ebay-predict is a simple tag to prefetch static assets from a prediction service. A prediction service is a server endpoint, that responds with the suggested JSON schema (see below). If the service is not hosted on the same origin as the page, please ensure proper CORS support is enabled.
<ebay-predict> triggers the prefetch only after the page
load event and use the
requestIdleCallback API, to ensure the current page is rendered without any interferance. If
requestIdleCallback API is not available, then the provided delay is used.
- Install and save the module
npm install ebay-predict --save
- Add dependency in your page
- The module exposes a tag
<ebay-predict>. This can be embeded in the
<footer>tag of page HTML
||String||No||prediction service endpoint (mandatory)|
||String||No||Only used when
||String||No||a limit on the number of resources (for each type) to be prefetched. Use caution when prefetching more than 2 resources, as that may contend with current page bandwidth (default:
Prediction service JSON schema and sample response
- Chrome (desktop & Android)
- Safari (desktop & iOS)
- Android WebKit
Have a bug or a feature request? Please open a new issue
Pull Requests welcome. Please submit Github issues for any feature enhancements, bugs or documentation problems.
Copyright (c) 2018 eBay Inc.
Released under the MIT License