Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rajikaimal/aint

:tada: Simpler and minimal state management
https://github.com/rajikaimal/aint

Last synced: 10 days ago
JSON representation

:tada: Simpler and minimal state management

Awesome Lists containing this project

README

        

# aint

Simpler and minimal state management

ain't nobody got time for complex state

### Usage

```js
const aint = require("aint");
const loggerMiddlware = aint.loggerMiddlware();
aint.use(loggerMiddlware);

aint.publish("user", { firstname: "Rajika", lastname: "Imal" })
.then(state => {
console.log(state);
})
.catch(err => {
console.log(err);
});

aint.publish("user.status", { private: false })
.then(state => {
console.log(state);
})
.catch(err => {
console.log(err);
});

aint.subscribe("user")
.then(state => {
console.log(state);
})
.catch(err => {
console.log(err);
});

aint.get();
aint.get("user");
aint.get("user.firstname");
```

```js
{
user: {
firstname: "Rajika",
lastname: "Imal"
}
blog: {
url: "rajikimal.github.io"
}
}
```

### API