vue-use-web
| Install | |
|---|---|
npm install vue-use-web |
|
| Latest Version: | 1.0.1 |
| Vue: | 2 |
| License: | MIT |
| Last Updated: | Mar 4, 2023 |
| Links: | GitHub · npm |
vue-use-web
Web APIs implemented as Vue.js composition functions.
This is a collection of Web APIs exposed as Vue.js composition hooks that's upcoming in Vue 3.0
You can use them with Vue 2.0 using @vue/composition-api until Vue 3.0 gets out.
What and why
Web APIs are ever changing, this library aims to provide to Vue.js developers a stable interface that integrates well into the ecosystem. Also an interface that degrades gracefully when browsers do not support said features.
I initially was choosing to expose this as a Stateful functional components but that isn't very handy and is not future proof. Implementing these APIs in Vue composition API (hooks) makes them ready for Vue 3.0 and beyond. Personally I think this is the perfect example to showcase the power of the Composition API.
Installation
# install with yarn
yarn add @vue/composition-api vue-use-web
# install with npm
npm install @vue/composition-api vue-use-web
Usage
Kindly Check the documentation for examples.
APIs
Each composition function is designed to degrade gracefully so you can safely use them, but you should use these as a progressive enhancements for your apps. Check browsers compatibilities for each API.
- Battery Status API.
- Clipboard API.
- Device Light.
- Device Motion.
- Device Orientation.
- Event Listener.
- Fetch API.
- Full-screen.
- Geo-location API.
- Hardware Concurrency
- Intersection Observer.
- Localstorage API
- Media Query
- Mouse Position
- Network Information API.
- Preferred Color Scheme.
- Preferred Languages.
- Script.
- WebSocket.
- Window Scroll Position.
- Window Size.
- Worker.
- Notification.
- Media Devices.
- Bluetooth (TODO).
- Share (TODO).
- ResizeObserver (WIP)
Inspiration
This library is inspired by the-platform and standard-hooks for React.js.
License
MIT
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.0.1 | ^2.6.10 | MIT | |
| 1.0.0 | ^2.6.10 | MIT | |
| 0.10.1 | ^2.6.11 | MIT | |
| 0.10.0 | ^2.6.10 | MIT | |
| 0.9.0 | ^2.6.10 | MIT | |
| 0.8.0 | ^2.6.10 | MIT | |
| 0.7.0 | ^2.6.10 | MIT | |
| 0.6.0 | ^2.6.10 | MIT | |
| 0.5.0 | ^2.6.10 | MIT | |
| 0.4.0 | ^2.6.10 | MIT | |
| 0.3.1 | ^2.6.10 | MIT | |
| 0.3.0 | ^2.6.10 | MIT | |
| 0.2.3 | ^2.6.10 | MIT | |
| 0.2.2 | ^2.6.10 | MIT | |
| 0.2.1 | ^2.6.10 | MIT | |
| 0.2.0 | ^2.6.10 | MIT | |
| 0.1.2 | ^2.6.10 | MIT | |
| 0.1.1 | ^2.6.10 | MIT | |
| 0.1.0 | ^2.6.10 | MIT | |
| 0.0.2 | ^2.6.10 | MIT | |
| 0.0.1 | ^2.6.10 | MIT |