{"id":20022217,"url":"https://github.com/lucifier129/sukkula","last_synced_at":"2025-05-05T01:31:22.435Z","repository":{"id":57374273,"uuid":"247656582","full_name":"Lucifier129/sukkula","owner":"Lucifier129","description":"A state-management library aims to combine the best parts of redux and rxjs","archived":false,"fork":false,"pushed_at":"2020-03-16T21:35:17.000Z","size":388,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-01T17:19:00.816Z","etag":null,"topics":["react","react-hooks","redux","redux-observable","rxjs","state-management"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lucifier129.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-16T09:08:40.000Z","updated_at":"2023-03-07T14:58:14.000Z","dependencies_parsed_at":"2022-09-17T16:51:38.342Z","dependency_job_id":null,"html_url":"https://github.com/Lucifier129/sukkula","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lucifier129%2Fsukkula","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lucifier129%2Fsukkula/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lucifier129%2Fsukkula/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lucifier129%2Fsukkula/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lucifier129","download_url":"https://codeload.github.com/Lucifier129/sukkula/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252423120,"owners_count":21745547,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react","react-hooks","redux","redux-observable","rxjs","state-management"],"created_at":"2024-11-13T08:39:36.010Z","updated_at":"2025-05-05T01:31:17.427Z","avatar_url":"https://github.com/Lucifier129.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sukkula\n\n\u003e A state-management library aims to combine the best parts of redux and rxjs\n\n[![NPM](https://img.shields.io/npm/v/sukkula.svg)](https://www.npmjs.com/package/sukkula)\n\n## Install\n\n```bash\nnpm install --save sukkula\n```\n\n## Usage\n\n```tsx\nimport { setupState, setupEffect, createStore } from 'sukkula'\nimport { interval } from 'rxjs'\nimport { map, switchMap, takeUntil } from 'rxjs/operators'\n\n// define setup function\nlet setupCounter = (initialCount = 0) =\u003e {\n  // setup state via initialState and reducers\n  let { state$, actions } = setupState({\n    state: initialCount,\n    reducers: {\n      incre: state =\u003e state + 1,\n      decre: state =\u003e state - 1\n    }\n  })\n\n  // setup effect action for stopping\n  let stop = setupEffect()\n\n  // setup effect action for starting\n  let start = setupEffect(input$ =\u003e {\n    return input$.pipe(\n      switchMap((period = 1000) =\u003e {\n        return interval(1000).pipe(\n          map(() =\u003e actions.incre()),\n          takeUntil(stop.input$)\n        )\n      })\n    )\n  })\n\n  // return the pair { state$, actions }\n  return {\n    state$,\n    // merge pure-actions and effect-actions\n    actions: {\n      ...actions,\n      start,\n      stop\n    }\n  }\n}\n\nlet store = createStore(() =\u003e {\n  return setupCounter(10)\n})\n\nstore.state$.subscribe(state =\u003e {\n  console.log('state', state)\n})\n\nstore.actions.start()\n```\n\n## License\n\nMIT © [Lucifier129](https://github.com/Lucifier129)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucifier129%2Fsukkula","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucifier129%2Fsukkula","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucifier129%2Fsukkula/lists"}