Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stagfoo/obake
👹 statement management with proxies and promise on glitch
https://github.com/stagfoo/obake
frontend promise proxy react state-management vue
Last synced: about 7 hours ago
JSON representation
👹 statement management with proxies and promise on glitch
- Host: GitHub
- URL: https://github.com/stagfoo/obake
- Owner: stagfoo
- Created: 2018-12-20T08:28:55.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-11-01T07:56:52.000Z (14 days ago)
- Last Synced: 2024-11-01T08:27:35.676Z (14 days ago)
- Topics: frontend, promise, proxy, react, state-management, vue
- Language: TypeScript
- Homepage: https://obake.glitch.me/
- Size: 191 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
Statement management with proxies and promise...in a dead simple way
---
# Installation
```
npm install obake.js --save
```# Why make this?
- I found objects in javascript and that have mutation listeners
- they allow for valuation |・д・)ノ
- promise based so no race conditions! ( ´ ▿ ` )## Examples
```js
// the defaultState is the state you want to proxy//store.ts
import { reducer } from 'obake.js';export const defaultState = {
greeting: 'Spooky Ghost (ノ⊙﹏⊙)ノ',
}export const reducers = {
updateGreeting: reducer((state, value: string) => {
state.greeting = value;
}),
}//actions.ts
import { state } from './store';export function handleGreetingClick() {
state._update('updateGreeting', "Calm Ghost ( ´ ▿ ` )")
};```
as you can see however it takes an reducer name which must be registered in the reducers,
this way you can't just mutate the object willy nilly.there you go; you have reducers, you have a safe way to mutate it your store.
*Optional* function `reducer` to make your reducers easier to read and keep the return consistent but its optional
[View Reducer Function](https://github.com/stagfoo/obake/blob/5c701ab5e7bf9144c182f314aba9d557190ac657/src/index.ts#L33)
## Demo
https://obake.glitch.me/# Support
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/H2H616GHW)