{"id":25526141,"url":"https://github.com/exbotanical/seance","last_synced_at":"2026-01-05T19:30:14.382Z","repository":{"id":65493547,"uuid":"358497068","full_name":"exbotanical/seance","owner":"exbotanical","description":"Cross-domain storage for the frontend","archived":false,"fork":false,"pushed_at":"2021-04-22T06:14:58.000Z","size":608,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-15T12:42:12.252Z","etag":null,"topics":["cross-domain","cross-origin","cross-origin-local-storage","localstorage-api","postmessage","state-management"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/seance-js","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/exbotanical.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":"2021-04-16T06:22:04.000Z","updated_at":"2021-04-29T05:58:10.000Z","dependencies_parsed_at":"2023-01-26T03:01:06.584Z","dependency_job_id":null,"html_url":"https://github.com/exbotanical/seance","commit_stats":null,"previous_names":["matthewzito/seance"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exbotanical%2Fseance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exbotanical%2Fseance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exbotanical%2Fseance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exbotanical%2Fseance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/exbotanical","download_url":"https://codeload.github.com/exbotanical/seance/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239735258,"owners_count":19688262,"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":["cross-domain","cross-origin","cross-origin-local-storage","localstorage-api","postmessage","state-management"],"created_at":"2025-02-19T21:16:48.613Z","updated_at":"2026-01-05T19:30:14.324Z","avatar_url":"https://github.com/exbotanical.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Séance | Cross-origin State Sharing\n\n[![Build Status](https://travis-ci.org/MatthewZito/seance.svg?branch=master)](https://travis-ci.org/MatthewZito/seance)\n[![Coverage Status](https://coveralls.io/repos/github/MatthewZito/seance/badge.svg)](https://coveralls.io/github/MatthewZito/seance)\n[![npm version](https://badge.fury.io/js/seance-js.svg)](https://badge.fury.io/js/seance-js)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\nSéance enables cross-domain state sharing via the browser's local storage.\n\nA Séance can be agreed upon by any number of domains. A `Seance` instance is initialized at the domain you want to serve as the *provider*. Each domain that subscribes to this shared state registers a `Medium`, allowing it to observe the shared state, and perform read / write transactions with it.\n\nMediums use iframes to proxy the Seance provider. When initialized, a Seance will listen for any Medium in its list of registered domains (this can be explicit strings or a group of regular expressions). Once a Medium registers itself with the Seance, it can begin a `sequence`. A `sequence` is a Promise that when fulfilled provides an API exposing `get`, `set`, `delete`, and `enumerate` operations that read from and write to the shared state.\n\nMediums poll the Seance connection in a handshake exchange series of SYN/ACK messages. If at any point the connection is lost, interrupted, or ended, the `sequence` will reject.\n\n## Table of Contents\n\n- [Supported Environments](#builds)\n- [Installation + Usage](#usage)\n- [Documentation / API](#docs)\n- [Upcoming Features](#upcoming)\n- [Testing](#test)\n\n## \u003ca name=\"builds\"\u003e\u003c/a\u003e Supported Environments\n\n`seance` is a frontend system that currently supports UMD and ESM build-targets. Is your preferred build not supported? Open an issue!\n\n## \u003ca name=\"usage\"\u003e\u003c/a\u003e Installation and Usage\n\nInstall:\n\n```bash\nnpm install seance-js\n```\n\nor\n\n```bash\nyarn add seance-js\n```\n\nInitializing a `Seance`:\n\n```js\n// at https://domain.com\nimport { Seance } from 'seance-js';\n\nSeance(['https://otherdomain.com']);\n```\n\nRegistering `Mediums`:\n\n```js\n// at https://otherdomain.com\nimport { Medium } from 'seance-js';\n\nfunction handleConnErr (ex) { ... }\n\nconst medium = Medium({\n  // the origin of the `Seance`\n  seanceOrigin: 'https://domain.com',\n  // callback to invoke when `Medium` is initialized, receives the `Medium`'s uuid\n  created: (id) =\u003e console.log({ CREATED: id }),\n  // callback to invoke when `Medium` is unmounted, receives the `Medium`'s uuid\n  destroyed: (id) =\u003e console.log({ DESTROYED: id })\n});\n\nconst keysToSet = [{ key1: 'value1'}, { key2: 'value2' }];\n\n// begin sequence\nmedium.sequence()\n  // connection OK, return api\n  .then(api =\u003e {\n    // set key/val pairs in shared state\n    api.set(\n      keysToSet,\n      // each api method accepts a callback that is invoked when the operation succeeds (or fails)\n      function (error, response) {\n        if (error) // handle err\n        else if (response) // handle response\n      });\n  })\n  .catch(handleConnErr);\n\nconst keysToGet = ['key1'];\n\nmedium.sequence()\n  .then(api =\u003e {\n    api.get(keysToGet, (error, response) =\u003e ...)\n  })\n  .catch(handleConnErr);\n\nmedium.sequence()\n  .then(api =\u003e {\n    api.delete(['key2'], (error, response) =\u003e ...);\n  })\n  .catch(handleConnErr);\n\n```\n\n## \u003ca name=\"docs\"\u003e\u003c/a\u003e Documentation and API\n\n## \u003ca name=\"upcoming\"\u003e\u003c/a\u003e Upcoming Features\n\n- permissions\n- `enumerate` and `clear` APIs\n- adapters for different browser storage types\n- IE support\n\n## \u003ca name=\"test\"\u003e\u003c/a\u003e Testing\n\nThis package is tested with Jest and JSDOM. Test suites *must* be run serially with `--runInBand` to avoid cross-pool propagation of events.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexbotanical%2Fseance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexbotanical%2Fseance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexbotanical%2Fseance/lists"}