{"id":17881016,"url":"https://github.com/apaleslimghost/enviante","last_synced_at":"2025-07-19T08:13:33.189Z","repository":{"id":30861697,"uuid":"34419269","full_name":"apaleslimghost/Enviante","owner":"apaleslimghost","description":"📩 Decoupled, predictable application state. Subscribe anywhere, dispatch anywhere.","archived":false,"fork":false,"pushed_at":"2017-03-27T21:12:36.000Z","size":197,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T10:21:21.967Z","etag":null,"topics":["dispatcher","intent","receiver","redux","state-management","subscription"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apaleslimghost.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-22T22:25:24.000Z","updated_at":"2019-02-08T22:28:38.000Z","dependencies_parsed_at":"2022-08-24T11:00:37.091Z","dependency_job_id":null,"html_url":"https://github.com/apaleslimghost/Enviante","commit_stats":null,"previous_names":["quarterto/enviante"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apaleslimghost%2FEnviante","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apaleslimghost%2FEnviante/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apaleslimghost%2FEnviante/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apaleslimghost%2FEnviante/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apaleslimghost","download_url":"https://codeload.github.com/apaleslimghost/Enviante/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244943690,"owners_count":20536279,"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":["dispatcher","intent","receiver","redux","state-management","subscription"],"created_at":"2024-10-28T12:33:01.297Z","updated_at":"2025-03-22T10:30:59.724Z","avatar_url":"https://github.com/apaleslimghost.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n\t\u003cimg src=\"/logo.png\" width=\"600\"\u003e\u003cbr\u003e\n\t\u003ca href=\"https://npmjs.org/package/enviante\"\u003e\u003cimg src=\"https://badge.fury.io/js/enviante.svg\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://travis-ci.org/quarterto/Enviante\"\u003e\u003cimg src=\"https://travis-ci.org/quarterto/Enviante.svg\"\u003e\u003c/a\u003e\n\u003c/h1\u003e\n\n```sh\nnpm install enviante\n```\n\nDecoupled, predictable application state. Subscribe anywhere, dispatch anywhere.\n\n```js\nimport createStore from 'enviante';\nconst connect = createStore({count: 0});\n\nconnect(({subscribe}) =\u003e {\n\tdocument.getElementById('counter').innerHTML = subscribe('count');\n});\n\nconnect(({dispatch}) =\u003e {\n\tdocument.getElementById('increment').addEventListener('click', () =\u003e {\t\t\n\t\tdispatch('count', count =\u003e count + 1);\n\t});\n});\n\n```\n\n`connect = createStore(state)`\n---\n\nCreate a new store with an initial state. Returns a function to connect to the store.\n\n`connect(receiver: ({subscribe, dispatch, unsubscribe, meta}) =\u003e {})`\n---\n\nSets up a connection from the store via the receiver. The function is called an object containing keys `subscribe`, `dispatch`, `unsubscribe`, and `meta`. Call `subscribe` to register a subscription to part of the state: when the state changes, the receiver is called again. Call `dispatch` to change part of the state and notify subscribers. Call `unsubscribe` to remove subscriptions. `meta` is information passed along with a `dispatch`, see [below](#dispatchstate-path-updater).\n\nThe receiver is called once, immediately. It will only be called again if you `subscribe` to any state. If you don't call `subscribe`, it's safe to register event handlers etc. in here.\n\n`subscribe(['state', 'path'], defaultValue)`\n---\n\nReturns the nested state value at the path, falling back to a default value. Future dispatches to this path (or a sub-path) will call the receiver again.\n\n`dispatch(['state', 'path'], updater, meta)`\n---\nModifies the nested state value at the path with an updater function. The updater is called with the previous value, and its return value replaces the state at the path. If the updater returns undefined, the previous value is used. If the value is an object, mutations will be kept.\n\nAny previous subscriptions at this path (or a sub-path) will call the receiver again. The last argument, `meta`, is passed along to receivers, which is useful for things like ignoring updates from certain sources.\n\n`unsubscribe(['state', 'path'])`\n---\n\nRemoves any previous subscription to the path. Future subscriptions will still cause reruns.\n\nInspiration\n---\n\n[Redux](https://github.com/react/redux) and Meteor's [`react-meteor-data`](https://atmospherejs.com/meteor/react-meteor-data).\n\nI love Redux. I find it hard to build my state and components in the top-down way it seems to favour, and mutating state can be nicer than deep immutable updates. I also love Meteor, but Tracker is far too magic.\n\nEnviante lets you imbue any part of your application with an arbitrary chunk of state. If your dispatches are pure, your state is predicable. Since each dispatch only sees a small part of the state, it's also safe to mutate in-place.\n\nHistory\n---\n\nVersions 1 and 2: Highland streams. \"Receivers\" that receive \"Intents\" and return a stream of Intents. Hard to reason about laziness, need to manually drain everything.\n\nVersion 3: Bacon streams. Concept of nested state appears. All receivers are passed in as a tree on init. Still a bunch of internal mystery meat, still weird laziness constraints.\n\nLicence\n---\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapaleslimghost%2Fenviante","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapaleslimghost%2Fenviante","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapaleslimghost%2Fenviante/lists"}