{"id":13734929,"url":"https://github.com/sterpe/react-webstorage","last_synced_at":"2025-08-20T14:11:35.360Z","repository":{"id":25023988,"uuid":"28443382","full_name":"sterpe/react-webstorage","owner":"sterpe","description":"Use webStorage or a webStorage polyfill as a React store","archived":false,"fork":false,"pushed_at":"2014-12-24T23:14:55.000Z","size":156,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-21T10:02:59.332Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/sterpe.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":"2014-12-24T09:07:16.000Z","updated_at":"2016-03-15T08:40:17.000Z","dependencies_parsed_at":"2022-08-23T11:30:52.455Z","dependency_job_id":null,"html_url":"https://github.com/sterpe/react-webstorage","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sterpe%2Freact-webstorage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sterpe%2Freact-webstorage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sterpe%2Freact-webstorage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sterpe%2Freact-webstorage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sterpe","download_url":"https://codeload.github.com/sterpe/react-webstorage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243495498,"owners_count":20299923,"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":[],"created_at":"2024-08-03T03:01:01.282Z","updated_at":"2025-03-13T23:10:31.223Z","avatar_url":"https://github.com/sterpe.png","language":"JavaScript","funding_links":[],"categories":["awesome-web-storage [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)"],"sub_categories":["Different Storage APIs"],"readme":"react-webstorage\n===\n\nUse any implementation of W3C WebStorage API directly as a React/Flux-style store.\n\n````javascript\nvar WebStorage = require('react-webstorage')\n, dispatcher = require('./path/to/app-dispatcher')\n;\n\nvar webStorage = new WebStorage(window.localStorage ||\n\twindow.sessionStorage /* or poly-fill thereof */\n);\n\ndispatcher.register(function (payload) {\n\tswitch (payload.actionType) {\n\tcase 'A':\n\t\twebStorage.setItem(payload.key, payload.item);\n\t\tbreak;\n\tcase 'B':\n\t\twebStorage.removeItem(payload.key);\n\t\tbreak;\n\tcase 'C': \n\t\twebStorage.clear();\n\t\tbreak;\n\tdefault:\n\t\treturn;\n\t}\n});\n\n// Later, inside a component...\n\n\tgetInitialState: function () {\n\t\treturn {\n\t\t\tfoo: webStorage.getItem('foo');\n\t\t};\n\t},\n\tupdateState: function () {\n\t\tthis.setState({\n\t\t\tfoo: webStorage.getItem('foo')\n\t\t});\n\t},\n\tcomponentDidMount: function () {\n\t\twebStorage.addListener('change', this.updateState);\n\t},\n\tcomponentWillUnmount: function () {\n\t\twebStorage.removeListener('change', this.updateState);\n\t}\n\n````\nWebStorage Instance implements the WebStorage API, and in cases where the contents of WebStorage is modified (setItem, removeItem, clear) fires a `change`  event to registered listeners.\n\nWebStorage API details here: https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsterpe%2Freact-webstorage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsterpe%2Freact-webstorage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsterpe%2Freact-webstorage/lists"}