{"id":19839962,"url":"https://github.com/alekseykulikov/storage-emitter","last_synced_at":"2025-05-01T19:30:32.729Z","repository":{"id":57113929,"uuid":"39262434","full_name":"alekseykulikov/storage-emitter","owner":"alekseykulikov","description":"Emit events between browser tabs","archived":false,"fork":false,"pushed_at":"2017-01-31T13:58:12.000Z","size":56,"stargazers_count":29,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-18T18:34:59.331Z","etag":null,"topics":["browser","emitter","localstorage"],"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/alekseykulikov.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-07-17T15:56:39.000Z","updated_at":"2021-06-07T11:59:33.000Z","dependencies_parsed_at":"2022-08-22T08:31:21.673Z","dependency_job_id":null,"html_url":"https://github.com/alekseykulikov/storage-emitter","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/alekseykulikov%2Fstorage-emitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekseykulikov%2Fstorage-emitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekseykulikov%2Fstorage-emitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekseykulikov%2Fstorage-emitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alekseykulikov","download_url":"https://codeload.github.com/alekseykulikov/storage-emitter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251932541,"owners_count":21667162,"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":["browser","emitter","localstorage"],"created_at":"2024-11-12T12:24:58.377Z","updated_at":"2025-05-01T19:30:32.368Z","avatar_url":"https://github.com/alekseykulikov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# storage-emitter\n\n[![](https://img.shields.io/npm/v/storage-emitter.svg)](https://npmjs.org/package/storage-emitter)\n[![](https://img.shields.io/travis/alekseykulikov/storage-emitter.svg)](https://travis-ci.org/alekseykulikov/storage-emitter)\n[![](http://img.shields.io/npm/dm/storage-emitter.svg)](https://npmjs.org/package/storage-emitter)\n\n\u003e Emit events between browser tabs.\n\nIt's a small wrapper around\n[`window.onstorage`](http://www.w3.org/TR/webstorage/#the-storage-event) event,\nwhich is a part of WebStorage specification and available in IE8+ browsers.\n\nIt works like a regular instance of [EventEmitter](https://github.com/component/emitter),\nwith the only difference that event is fired in all open tabs for same domain.\n\nPossible applications:\n\n- perform **logout** in all open tabs\n- sync in-memory objects between browser tabs, like [swarm.js](https://github.com/gritzko/swarm#storages)\n- polyfill `indexeddb.onversionchange` event in [Safari](https://bugs.webkit.org/show_bug.cgi?id=136155)\n\n## Example\n\n```js\nimport sEmitter from 'storage-emitter'\n\n// listen to \"logout\" event\n\nsEmitter.on('logout', () =\u003e\n  location.reload()\n})\n\n// call \"logout\" from another tab\n\nsEmitter.emit('logout')\n```\n\n## Installation\n\n    $ yarn add storage-emitter\n    $ npm i -S storage-emitter\n\n## API\n\n### sEmitter.on(event, callback)\n\nSubscribe on `event` across all open application instances.\n\n### sEmitter.emit(event, args)\n\nEmit `event` with `args` to all open tabs.\n\n### sEmitter.off([event])\n\nUnsubscribe from all events or one specific `event`.\n\n## License\n\n[MIT]('./LICENSE')\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falekseykulikov%2Fstorage-emitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falekseykulikov%2Fstorage-emitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falekseykulikov%2Fstorage-emitter/lists"}