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

clockvine

v2.0.0-alpha.12

Published

Clockvine =========

Downloads

24

Readme

Clockvine

Clockvine 2 is under development and should be considered unstable.

Clockvine is a Vue 3 library for providing reactive objects in front of back end APIs.

Documentation

defineApiStore

defineApiStore returns a Pinia Store with the following actions:

  • index(paramsRef) - Returns a Proxy object whose attributes are readonly reactive references to the respective keys in the API response. In practice, you can think of this as { data: ref<Array>, meta: ref<Object> } and you'd use it like this:
const { data, meta } = clockvineStore.index()

// You can also use destructuring to use a better variable name than data:
const { data: users, meta } = clockvineStore.index()
  • indexAsRef(paramsRef) - Returns a readonly reactive ref object for the index itself. You probably don't want to use this one, but in practice, you can think of this as ref<{ data: Array, meta: Object}>, where you need to get the value of the index before accessing attributes.

  • invalidateIndex(paramsRef) - Invalidates the cached version of an index. If anything is using the index, a new API request will happen automatically.

  • invalidateAllIndexes() - invalidates all indexes within the clockvine store.

  • show(idRef) - Returns a readonly reactive ref object for the element with primary key idRef. if idRef is reactive, then idRef will be a reactive dependency.

  • store(element) - Stores element in the back end and returns a readonly reactive ref object of the new element. Invalidates all cached indexes.

  • update(element) - Updates element in the back end and returns a readonly reactive ref object of the updated element. Invalidates all cached indexes.

  • destroy(element) - Deletes element in the back end and returns the element. Invalidates all cached indexes.

  • invalidate(elementOrIdRef) - Invalidates the cached version of the element specified. If anything is using this element still, a new API request will happen automatically.

Clockvine is lazy - simply getting a reactive reference to an index or element will not cause any API queries to happen. API queries will happen when the values are used.

JsonApi

JsonApi implements the back end 'interface' required by Clockvine and encapsulates all communication with the external API. JsonApi is a minimal example based on fetch().

Planned Features

  • Request Queueing
  • Concurrency Management
  • Set Request Headers

JsonSingletonApi

JsonSingletonApi is similar to JsonApi but is meant for API endpoints that only manage a single element (no index or primary keys.) It doesn't work yet.