npm package: @infini-store/core
Description: Micro Event Driven and State Management.
Author: Infinisoft Inc.
Latest version: 1.3.0
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

<!-- markdownlint-disable-next-line -->
![https://s3.amazonaws.com/storage.infini-soft.com/banner1.gif](https://s3.amazonaws.com/storage.infini-soft.com/banner1.gif) 

# ✨ Features

|                                                               |                      |                                  |
| ------------------------------------------------------------- | -------------------- | -------------------------------- |
| [React 18](https://www.npmjs.com/package/@infini-store/react) | Event Driven Pub/Sub | Integration API                  |
| Web                                                           | Synchronous State    | [Live Inspect Devtool](#devtool) |
| Angular                                                       | Working Offline      | Persistency                      |
| Flutter                                                       | Sync any backend     | Middlewares                      |
| NodeJS                                                        | No dependency        |                                  |
| Typescript                                                    | Very small           |                                  |
| Javascript                                                    |                      |                                  |

# 📦 Install

```bash
$ npm install @infini-store/core --save
# or
$ yarn add @infini-store/core
```

## S Examples [Skip to code](#code)

Let's pretend you are Chief Technology Officer of Infinisoft Inc and following scenario is happening right now. Happyness Service is responsible of creating and onboarding new talents. Security Department is responsible for access management in our meta verse. Our head office has 2349 floors because we offer an entire floor per person.

## Context [Skip to code](#code)

Happyness Service

- Hire
- Onboard

Security Service

- Manage Credentials & Metaphysical Accesses

Food Service

- Order food

Veteran Service

- Veteran things

## Code

For simplicity, let's have store global.

```javascript examples/nodejs/state.js
exports.store = Store
```

```typescript
    import {Store} from "@infini-store/core"
    const _store = Store("initial");

    _store.subscribe("simple", (event, payload)=>{console(`event called `, e,`payload `, payload)});
    _store.emit("simple", "with infinistore");
```

```sh
$ ts-node simple.ts
event called simple payload with infinistore
```

## Devtool

Open devtool by pressing F12 in your browser. Make sure to install Redux Devtools

![https://s3.amazonaws.com/storage.infini-soft.com/devtool.gif](https://s3.amazonaws.com/storage.infini-soft.com/devtool.gif)

# Documentation

![./assets//lifecyclev4.gif](https://s3.amazonaws.com/storage.infini-soft.com/lifecyclev4.gif)

![./assets/subscription_lifecycle.gif](https://s3.amazonaws.com/storage.infini-soft.com/subscription_lifecycle.gif)

## 🌊 Infinistore

First no dependency, synchronous event driven, micro state management ecosystem. Under research & development since 2020, this design pattern is a game changer, decreasing software complexiity significantly.

Scalability is one of the most challenging topic in software engineering. Each line of code added increase complexity making it harder and harder to progress. Adding boilerplate required to handle asynchronous request, its errors, and multiple status is always cumbersumb, hard to understand and useless.

Things like progress bar, loadings, spinners, skeletons, save, edit buttons are not natural. These components were created by engineers, to cope the technicals problem surrounding asynchronous nature of requests. They considerably decrease user  and developers experience.

We though about a lightweight synchronous state management where loading is something from the past.

## ⚠️ Warning

> This package is prerelease and still under active  development.  
> Look out for the white paper coming soon. Subscribe to get your early copy.

## **API**

Following is how to perform CRUD operations towards the store.
<!-- markdownlint-disable-next-line -->
<br />

----

### **Create Store**s

const store = Store()
<!-- markdownlint-disable-next-line -->
---

### **Read Store**

getState(state=>state)
<!-- markdownlint-disable-next-line -->
---

### **Write Store**

mutate(state=>state)
<!-- markdownlint-disable-next-line -->
---

### **Emit**

emit(event, payload)
<!-- markdownlint-disable-next-line -->
---

### **Register**

Add a new middleware
register()
<!-- markdownlint-disable-next-line -->
---

### **Subscribe**

Subcscribe to 1 event.
subscribe(evvent, handler)
<!-- markdownlint-disable-next-line -->
---

### **SubscribeAll**

Subscribe to all event
subscribeAll(handler)
<!-- markdownlint-disable-next-line -->
<br />
<!-- markdownlint-disable-next-line -->
<br />

<!-- markdownlint-disable-next-line -->
_____________________________________________________________
<!-- markdownlint-disable-next-line -->
<br />
Powered 🚀 by [Infinisoft Inc.](https://www.infinisoft.world)
<!-- markdownlint-disable-next-line -->
<br />
Futur is now? Join us [https://www.infinisoft.world]