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

@biscuit-store/core

v1.4.1

Published

Library for management javascript application states.

Downloads

156

Readme

biscuit

JavaScript library for application state-management.

Build Status Typescript npm version release Build Status download

Twitter

Official library website

Description

Biscuit is a modular tool for creating and editing configurable containers for managed states. The goal of the Biscuit-store is to simplify the process of working with states as much as possible, while at the same time providing a consistent architectural approach.

Advantages:

  • Flexible architecture
  • immutable
  • Asynchronous out of the box
  • React support
  • Simple extension with middleware
  • Easy debugging

The approach to creating containers in a biscuit is simple and can be described using the example of creating a duck:

  1. Create a duck;
  2. Tell the duck that it is by definition a duck so it must swim, quack and fly;
  3. Teach the duck to swim, fly and quack.

Installation

Installation of core files

npm install @biscuit-store/core

installing the adapter extension

npm install @biscuit-store/adapter 

Installing an extension to share with react

npm install @biscuit-store/react 

Documentation

Help


Basic exemple

This example describes the process of creating a repository using the createStore method.

import { createStore } from "@biscuit-store/core";
import { connect } from "./counterAdapter";

const { store, actions } = createStore({
  name: "counter",
  initial: { value: 0 },
  actions: {
    increment: "increment/action",
    decrement: "decrement/action"
  },
  middleware: [connect]
});

const { increment, decrement } = actions;

increment.subscribe(() => {
  console.log("incremented");
})

decrement.subscribe(() => {
  console.log("decremented");
})

store.subscribe(({ value }) => {
  console.log("count:", value);
})

increment.dispatch({value: 1});

The adapter module is used for encapsulated state management.

import { createAdapter } from "@biscuit-store/adapter";
const { action, connect } = createAdapter();

action("increment/action", ({ payload, state }) => {
  state.value += payload.value;
});

action("decrement/action", ({ payload, state }) => {
  state.value -= payload.value;
});

export { connect };

Edit Biscuit-store/example-javascript

Example with combined actions

Combined actions are a way to create a repository with built-in managed states. This approach is ideal for stores with a small logical load.

import { createStore } from "@biscuit-store/core";

const { actions } = createStore({
  name: "counter",
  initial: { value: 0 },
  combineActions: {
    increment: (state) => {
      state.value += 1;
    },
    decrement: (state) => {
      state.value -= 1;
    },
  }
});

const { increment, decrement } = actions;

increment.dispatch().after(({ value }) => {
   console.log("count:", value);
});

Edit Biscuit-store/example-javascript (forked)

Some more examples

Tested in browsers

| Platform | | | | | | |----------|:--------:|:-----:|:-------:|:---------:|:--------:| | Version | 48+ | 11+ | 25+ | 40+ | 9+ | | Checked | | | | | |

Contributing

If you liked the library, you have many ways to help it develop.

  • You can write about the biscuit-store on various forums;
  • Put a star on github;
  • Write about the bugs found and suggest improvements;
  • Participate in the development, offer your pull request;
  • Or you can just help financially;

The rules of assistance can be found here.

Donate

Any financial help will help the biscuit to become better.

Inspiration

The idea of developing this library was inspired by the Redux project. During the introduction to the biscuit-store, you will see several patterns that are similar to the concepts of Redux. Nevertheless, biscuit is a separate library that uses completely different architectural principles.

Feedback

If you have any questions, suggestions, comments, suggestions for cooperation, or if you like the library and want to become a sponsor, please contact the developer by email: [email protected].

Changelog

You can see the list of changes here

Adolescence

  • The library is still young and is in beta testing, for this reason, you may stumble upon bugs and flaws. Please be constructive and help us make this tool better.
  • The developer is not a full-fledged native speaker of English, for this reason, there may be errors and tautologies in the documentation, if you have the opportunity to make the documentation better, then I will be glad of any help.

License

Copyright (c) 2021 Philipp Zhulev

MIT License (MIT).