@foresightjs/vue

Vue composables for ForesightJS - register elements with the ForesightManager from Vue components.
5,642 1,815
Install
npm install @foresightjs/vue
Latest Version:1.0.0
Vue:3
License:MIT
Last Updated:Oct 21, 2026
Links: GitHub  ·  npm
Maintainer: spaansba

@foresightjs/vue

npm version npm downloads

Official Vue 3 bindings for ForesightJS, a lightweight library that predicts user intent (mouse trajectory, keyboard navigation, scroll, touch) to trigger callbacks like prefetching before the user interacts.

Installation

pnpm add @foresightjs/vue js.foresight
# or
npm install @foresightjs/vue js.foresight

Requires Vue 3.5+

What's included

  • v-foresight -> directive to register an element with a callback or full options object
  • useForesight -> register a single element and get reactive refs for its state
  • Foresight -> component form of useForesight with a scoped slot
  • useForesightEvent -> subscribe to a ForesightManager event for the lifetime of the calling scope

For usage and examples, see the Vue documentation.

Contributing

Please see the contributing guidelines.

License

MIT

Related Packages

nuxt-vitalizer

Better Largest Contentful Paint scores in Google Lighthouse

1,029,747 172

Version History

Version Released Vue License
1.0.0 ^3.5.0 MIT
0.3.2 ^3.5.0 MIT
0.3.1 ^3.5.0 MIT
0.3.0 ^3.5.0 MIT
0.2.0 ^3.5.0 MIT