{"id":22744236,"url":"https://github.com/rametta/meatball","last_synced_at":"2025-04-14T09:23:00.287Z","repository":{"id":57293845,"uuid":"158836258","full_name":"rametta/meatball","owner":"rametta","description":"🍝 Future based redux side effects","archived":false,"fork":false,"pushed_at":"2018-12-05T18:35:38.000Z","size":124,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T10:50:27.479Z","etag":null,"topics":["async","epic","epics","future","io","redux"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rametta.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":"2018-11-23T13:26:11.000Z","updated_at":"2020-04-28T14:17:49.000Z","dependencies_parsed_at":"2022-09-01T13:01:41.210Z","dependency_job_id":null,"html_url":"https://github.com/rametta/meatball","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/rametta%2Fmeatball","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rametta%2Fmeatball/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rametta%2Fmeatball/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rametta%2Fmeatball/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rametta","download_url":"https://codeload.github.com/rametta/meatball/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248852329,"owners_count":21171874,"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":["async","epic","epics","future","io","redux"],"created_at":"2024-12-11T01:41:18.170Z","updated_at":"2025-04-14T09:23:00.264Z","avatar_url":"https://github.com/rametta.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm](https://img.shields.io/npm/v/meatball.svg)](http://npm.im/meatball)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)\n[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/rametta/meatball/)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n# 🍝 Meatball\n\n\u003e [Future](https://github.com/fluture-js/Fluture) based redux side effects\n\n*Alternative to rxjs and redux-observable*\n\n## Install\n```sh\nyarn add meatball\n```\n\nMeatball has a peer dependency on [fluture](https://github.com/fluture-js/Fluture)\n```sh\nyarn add fluture\n```\n\n## Usage examples\nListen to any redux action, perform side effect, return a new redux action to be fired\n```js\n// epics.js\nimport { searchRes, searchErr } from './reducer'\nimport { tryP, after } from 'fluture'\n\n// Simple example\nconst simpleEpic = {\n  type: 'SUBMIT_SEARCH', // listen for this action\n  do: ({ payload }) =\u003e tryP(() =\u003e fetch(payload)) // fetch async data\n    .map(res =\u003e res.json())\n    .map(data =\u003e searchRes(data)) // redux action to save data\n    .mapRej(e =\u003e searchErr(e)) // redux action for handling error\n}\n\n// Return multiple actions with an array\nconst multipleEpic = {\n  type: 'SUBMIT_SEARCH', // listen for this action\n  do: ({ payload }) =\u003e tryP(() =\u003e fetch(payload)) // fetch async data\n    .map(res =\u003e res.json())\n    .map(data =\u003e [searchRes(data), clearSidebar()]) // multiple actions\n}\n\n// Complex example\nconst complexEpic = {\n  type: 'SUBMIT_SEARCH', // listen for this action\n  latest: true, // Like rxjs switchMap, cancels previous action if not resolved\n  do: ({ payload }) =\u003e after(200, payload) // delay fetching data for 200ms\n    .chain(text =\u003e tryP(() =\u003e fetch(text)))\n    .map(res =\u003e res.json())\n    .map(data =\u003e [searchRes(data), clearSidebar()]) // multiple actions\n    .mapRej(searchErr)\n}\n\n// Debounce example\nconst debounceEpic = {\n  type: 'FILTER_SOMETHING', // listen for this action\n  debounce: 1000, // debounce this action call for 1s\n  do: ({ payload }) =\u003e tryP(() =\u003e fetch(payload)) // fetch async data\n    .map(res =\u003e res.json())\n    .map(data =\u003e filterRes(data)) // redux action to save data\n    .mapRej(filterErr)) // redux action for handling error\n}\n\nexport default [simpleEpic, multipleEpic, complexEpic, debounceEpic]\n\n// index.js\nimport meatball from 'meatball'\nimport epics from './epics'\n\nconst store = createStore(\n  reducers,\n  applyMiddleware(meatball(epics))\n)\n```\n\n[Real example](/example)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frametta%2Fmeatball","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frametta%2Fmeatball","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frametta%2Fmeatball/lists"}