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

zs-control

v1.2.5

Published

State management inspired by Zustand with strong TypeScript typing.

Downloads

1,371

Readme

MIT License

Zs Control

A lib zs-control tem a mesma ideia do zustand e redux pra controle de estado, porém o zs-control tem uma ideia de implementar novas funcionaldidades e novas ideias. A ideia de criar um canal de eventos onde possa ouvir e publicar ( parecido com golang ) e também a parte de observar qualquer mudar da aplicação é um forte chave dessa lib. O objetivo é tentar resolver problemas simples e criar métodos padrão para problemas na o web.

Autores

Uso/Exemplos

Usando o createStateMangement você pode criar um estado simples onde você tera um grande controle de sua aplicação.

import { z } from "zs-control";

interface AuthState {
  name: string;
  token: string;
}

export const useAuth = z.createStateManagement<AuthState>({
  state: () => ({
    name: "",
    token: "",
  }),
  set: (update) => ({
    setName: (name: string) => update({ name }),
  }),
});

Dentro do zs-control vamos encontrar a zStorage tem o papel de criar o storage de suas aplicação usando o hook criado como refência de estado para ter uma melhor performance e controle.

import { zStorage } from "zs-control";
import { useAuth } from "../hook/useAuth";

export const myStorageAuth = zStorage.setHook(useAuth).key("auth").config({
  typeStorage: "localStorage",
});

Já pensou em criar uma variável que morre durante o tempo que você quiser o uma função para visualizar qualquer alteração e retornar para o valor inicial com z.temp você pode fazer isso e suas possibildade são enorme

import { z } from "zs-control";

export const useTempValue = () =>
  z.temp({
    value: 0,
    watch: () => false,
    timeDestory: 5000,
  });