npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@khaledosman/vue3-axios

v1.1.3

Published

[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) [![Commi

Downloads

1

Readme

vue3-axios

JavaScript Style Guide Conventional Commits Commitizen friendly semantic-release PRs Welcome dependencies Status devDependencies Status npm npm Build Status

Composition API & Vue component helpers for making API requests and rendering the results in vue 3

Guide

The library offers 3 different layers of abstraction for making API requests that can be used separately:

  1. useAPI is a hook that can be used in any component and gives the user full control of the request (cancellation, caching, refetch, error & loading states)
  2. AxiosComponent is an Async component that uses the useAPI hook to render/mount itself only when the initial request is done and the results are ready. it delegates rendering of error / loading or results via named slots.
  3. VueAxiosComponent Which uses AxiosComponent to provide generic error & loading states and uses the new Suspense API to handle rendering of the Async Component. it delegates rendering of results via a named slot.

the useAPI hook uses cachedGet function for get requests which provides two different strategies: Online first, and offline first:

  • In Online first mode the request goes first to the network then saves the results in cache, or fallbacks to the cache if the user is offline or the network request fails, this is best-suited for content that needs to be always fresh.

  • In Offline first mode the results are returned from the cache first, then a network request is done in the background to update the cache for next use or go to the network if there're no results in cache. This is best suited for apps that need to work under any network condition like bad Wifi / Slow internet or even completely offline with the compromise of less fresh data (i.e twitter, facebook, instagram). It also offers the best performance since the user can see results instantly without even the need for a loading state.

Example

  • HelloWorldComponent is a use case example, which show cases how VueAxiosComponent can be used
  • VueAxiosComponent is an example, which show cases how AxiosComponent can be used
  • AxiosComponent is an example which show cases how useAPI hook can be used