{"id":20984220,"url":"https://github.com/regou/justore","last_synced_at":"2025-05-14T17:30:40.233Z","repository":{"id":57287533,"uuid":"41741728","full_name":"regou/justore","owner":"regou","description":"Just Flux Store, noting else","archived":false,"fork":false,"pushed_at":"2019-06-24T06:12:55.000Z","size":122,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T01:36:16.314Z","etag":null,"topics":["flux","immer","immutablejs","pubsub","rxjs","state-management"],"latest_commit_sha":null,"homepage":"","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/regou.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":"2015-09-01T13:56:28.000Z","updated_at":"2019-08-11T14:55:48.000Z","dependencies_parsed_at":"2022-08-26T00:50:19.346Z","dependency_job_id":null,"html_url":"https://github.com/regou/justore","commit_stats":null,"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regou%2Fjustore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regou%2Fjustore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regou%2Fjustore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regou%2Fjustore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/regou","download_url":"https://codeload.github.com/regou/justore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254194733,"owners_count":22030428,"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":["flux","immer","immutablejs","pubsub","rxjs","state-management"],"created_at":"2024-11-19T05:51:44.263Z","updated_at":"2025-05-14T17:30:35.223Z","avatar_url":"https://github.com/regou.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Justore\n\n[![Build Status via Travis CI](https://travis-ci.org/regou/justore.svg?branch=master)](https://travis-ci.org/regou/justore)\n[![NPM version](https://img.shields.io/npm/v/justore.svg)](https://www.npmjs.com/package/justore)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com)\n\nWe don't need flux , just the store!\n\n\n### Installation\n\n```sh\nnpm install justore --save\n```\n\n### Basic Usage\n\n```js\nvar justore = require(\"justore\");\nvar initData = {};\nvar store = new justore(initData,'Store Name');\n\n\n//Write or change data to store, return a Promise\nstore.write('todos',['drink','cook']);\n\n//Subscribe to change\nlet subscription = store.sub('todos.0',function(newVal,prevVal){\n  store.read('todos') === newVal //true, 'drink'\n});\n//Remember to clean up\nsubscription.unsubscribe();\n```\n\n\n### Advanced usage\n\n- `store.batchWrite([keyPaths], manipulateFunction);`\n    Batch write multiple data to the store, only emit if it's listed on the keyPaths\n```js\n    store.batchWrite(['vtext', 'enable'], draft =\u003e {\n      draft.vtext.i = 10\n      draft.enable = true\n      draft.pos = 12 // works, but no event emit\n    });\n```\n\n- `store.write(keyPath, data [,options])`\n\n    Write data to the store, return store\n```js\n    store.write('todos',['drink','cook'],{\n      //Boolean. If true, change the store without trigger any events\n      mute:false\n    });\n```\n        \n- `store.sub(keyPath[,onNext][,immediate])`\n\n    Subscribe to the store, if onNext is defined, return an Rx Subscription, else return an Rx stream\n```js\n    store.sub('todos.1',function (newVal, oldVal) {\n  \t  //do tings\n    });\n```\n\n- `store.read(keyPath)`\n\n    Get value for attribute by passing the key.\n```js\n    store.read(\"todos.0\") //--\u003e 'drink'\n```\n\n- `store.delete(keyPath)`\n\n    Useful when you want to delete a root key and it's data\n```js\n    store.delete(\"todos\")\n    store.report()  //--\u003e {}\n```\n\n- `store.report()`\n\n    return the full store data. You cannot manipulate it\n    \n- `store.debugOn`\n    \n   if a key in this array, will toggle JS breakpoints when writing that key\n\n\n\n### React Mixin helper\n- `store.createReactMixin(key)`\n \n    Return a mixin. Will call `onStoreChange` method on a React component when store change.\n\n### Auto unsubscibe\n\n    If the subscribed data has been deleted (not set to undefined), the subscription will unsubscribe automatically\n\n### Browser support\n\n    IE11 or higher\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fregou%2Fjustore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fregou%2Fjustore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fregou%2Fjustore/lists"}