Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/judehunter/glyx
The declarative state management library
https://github.com/judehunter/glyx
Last synced: 14 days ago
JSON representation
The declarative state management library
- Host: GitHub
- URL: https://github.com/judehunter/glyx
- Owner: judehunter
- License: mit
- Created: 2021-06-11T18:32:42.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-27T13:09:28.000Z (5 months ago)
- Last Synced: 2024-11-30T17:48:31.481Z (25 days ago)
- Language: TypeScript
- Size: 151 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# glyx
The declarative state management library. (*In the works*)|`yarn add glyx`|`npm i glyx`|
|---|---|
```ts
const store = createStore(() => {
const count = state(1)
const expensive = derived(() => count.$ ** 10, [count])const increment = action(() => count.$ += 1)
watch(() => {
console.log(count.$)
}, [count])return {count, expensive, increment}
})store.increment()
store.getState() // {count: 2, expensive: 1024}
```## TODO
- [x] Basic proof of concept
- [x] Subscribers / listeners (done: basic use case)
- [x] Watchers - passing previous and new value
- [ ] Comprehensive error handling, e.g. enforcing that the correct values are passed as dependencies. Includes TS support
- [ ] First-class TS support
- [ ] Exports for different frameworks, e.g. React, Vue, with specific APIs, like selectors
- [ ] Comparison functions
- [ ] Ready-to-use variants of declarations, like `action.set` to easily create a setter
- [ ] ...## How to contribute
- Use `yarn test` to run tests