New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

joqt

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

joqt

Joqt is a centerized Flux Store

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Joqt

Joqt is a centerized Flux Store

const { createStore } = require('joqt');

(async () => {
  const store = await createStore([
    {
      type: 'ADD_TODO',
      paths: ['todos'],
      reducer: ({ todos = [] }, message) => ({ todos: todos.concat([message]) })
    },
    {
      type: 'CLEAR_TODOS',
      paths: ['todos'],
      reducer: async function*({ todos = [] }) {
        while (true) {
          await new Promise(r => setTimeout(r, 1000));
          todos.shift();
          if (todos.length === 0) break;
          yield { todos };
        }
        return { todos };
      }
    }
  ]);

  store.subscribe(() => console.log(store.getState()));

  store.dispatch({ type: 'ADD_TODO', payload: 'do!' });
})();

Joqt store reduces prev state and action to next state, whenever action dispatched. We can control state predictably like Redux.

Joqt reducer can be a function, async function, generator function or async generator function. We can control asynchronous control flow like Redux-Saga.

To prevent from break state by race condition, Joqt needs paths with reducer that are part of state tree and that reducer receives as argument. Joqt serializes executions of reducers when reducers have overlapping state tree.

Installation

$ npm install --save joqt

License

MIT

Keywords

FAQs

Package last updated on 30 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc