{"id":13735581,"url":"https://github.com/arlac77/svelte-websocket-store","last_synced_at":"2025-05-15T14:03:03.172Z","repository":{"id":36649976,"uuid":"224747813","full_name":"arlac77/svelte-websocket-store","owner":"arlac77","description":"svelte store with a websocket backend","archived":false,"fork":false,"pushed_at":"2025-04-09T19:11:31.000Z","size":10086,"stargazers_count":290,"open_issues_count":12,"forks_count":22,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T19:45:47.098Z","etag":null,"topics":["store","svelte-v3","websocket"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arlac77.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-29T00:14:54.000Z","updated_at":"2025-04-09T19:11:33.000Z","dependencies_parsed_at":"2023-01-17T03:45:22.754Z","dependency_job_id":"c402d7df-e5d4-49c6-92f8-c20a9391b44b","html_url":"https://github.com/arlac77/svelte-websocket-store","commit_stats":{"total_commits":2353,"total_committers":8,"mean_commits":294.125,"dds":"0.29366765830854225","last_synced_commit":"86292c8240e29b59d312eb1782a774b25cc9fc66"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Fsvelte-websocket-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Fsvelte-websocket-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Fsvelte-websocket-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Fsvelte-websocket-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arlac77","download_url":"https://codeload.github.com/arlac77/svelte-websocket-store/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248977245,"owners_count":21192549,"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":["store","svelte-v3","websocket"],"created_at":"2024-08-03T03:01:08.482Z","updated_at":"2025-04-14T23:28:38.191Z","avatar_url":"https://github.com/arlac77.png","language":"JavaScript","funding_links":[],"categories":["Fetching Data","JavaScript"],"sub_categories":[],"readme":"[![Svelte v5](https://img.shields.io/badge/svelte-v5-orange.svg)](https://svelte.dev)\n[![npm](https://img.shields.io/npm/v/svelte-websocket-store.svg)](https://www.npmjs.com/package/svelte-websocket-store)\n[![License](https://img.shields.io/badge/License-0BSD-blue.svg)](https://spdx.org/licenses/0BSD.html)\n[![bundlejs](https://deno.bundlejs.com/?q=svelte-websocket-store\\\u0026badge=detailed)](https://bundlejs.com/?q=svelte-websocket-store)\n[![downloads](http://img.shields.io/npm/dm/svelte-websocket-store.svg?style=flat-square)](https://npmjs.org/package/svelte-websocket-store)\n[![GitHub Issues](https://img.shields.io/github/issues/arlac77/svelte-websocket-store.svg?style=flat-square)](https://github.com/arlac77/svelte-websocket-store/issues)\n[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Farlac77%2Fsvelte-websocket-store%2Fbadge\\\u0026style=flat)](https://actions-badge.atrox.dev/arlac77/svelte-websocket-store/goto)\n[![Styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![Known Vulnerabilities](https://snyk.io/test/github/arlac77/svelte-websocket-store/badge.svg)](https://snyk.io/test/github/arlac77/svelte-websocket-store)\n[![Coverage Status](https://coveralls.io/repos/arlac77/svelte-websocket-store/badge.svg)](https://coveralls.io/github/arlac77/svelte-websocket-store)\n[![Tested with TestCafe](https://img.shields.io/badge/tested%20with-TestCafe-2fa4cf.svg)](https://github.com/DevExpress/testcafe)\n\n# svelte-websocket-store\n\nSvelte store with a websocket backend\n\n```js\nimport websocketStore from \"svelte-websocket-store\";\n\nconst initialValue = { };\nexport const myStore = websocketStore(\"wss://mydomain.com/ws1\", initialValue, ['option 1', 'option 2']);\n\n\n// send JSON to websocket server\n$myStore = { content: \"to be saved\", other_values: \"all\" };\n\n\n// receive JSON from server (push)\nlet response = $myStore;\n```\n\n# API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### Table of Contents\n\n*   [active](#active)\n    *   [Parameters](#parameters)\n*   [Key](#key)\n    *   [Properties](#properties)\n*   [BaseRouter](#baserouter)\n    *   [Parameters](#parameters-1)\n    *   [Properties](#properties-1)\n    *   [component](#component)\n    *   [value](#value)\n    *   [path](#path)\n    *   [path](#path-1)\n        *   [Parameters](#parameters-2)\n    *   [replace](#replace)\n        *   [Parameters](#parameters-3)\n    *   [push](#push)\n        *   [Parameters](#parameters-4)\n    *   [finalizePush](#finalizepush)\n        *   [Parameters](#parameters-5)\n    *   [continue](#continue)\n        *   [Parameters](#parameters-6)\n    *   [abort](#abort)\n        *   [Parameters](#parameters-7)\n    *   [subscribe](#subscribe)\n        *   [Parameters](#parameters-8)\n    *   [updateActive](#updateactive)\n        *   [Parameters](#parameters-9)\n    *   [addRoute](#addroute)\n        *   [Parameters](#parameters-10)\n    *   [routeFor](#routefor)\n        *   [Parameters](#parameters-11)\n    *   [pathFor](#pathfor)\n        *   [Parameters](#parameters-12)\n*   [BaseTransition](#basetransition)\n    *   [searchParams](#searchparams)\n    *   [searchParams](#searchparams-1)\n        *   [Parameters](#parameters-13)\n    *   [nest](#nest)\n        *   [Parameters](#parameters-14)\n    *   [continue](#continue-1)\n    *   [abort](#abort-1)\n        *   [Parameters](#parameters-15)\n*   [DetailRoute](#detailroute)\n    *   [Properties](#properties-2)\n    *   [master](#master)\n    *   [first](#first)\n    *   [last](#last)\n    *   [previous](#previous)\n    *   [next](#next)\n*   [Entitlement](#entitlement)\n    *   [Parameters](#parameters-16)\n*   [Guard](#guard)\n    *   [enter](#enter)\n        *   [Parameters](#parameters-17)\n    *   [leave](#leave)\n        *   [Parameters](#parameters-18)\n*   [redirectGuard](#redirectguard)\n    *   [Parameters](#parameters-19)\n*   [sequenceGuard](#sequenceguard)\n    *   [Parameters](#parameters-20)\n*   [parallelGuard](#parallelguard)\n    *   [Parameters](#parameters-21)\n*   [websocketStore](#websocketstore)\n    *   [Parameters](#parameters-22)\n*   [login](#login)\n    *   [Parameters](#parameters-23)\n*   [handleFailedResponse](#handlefailedresponse)\n    *   [Parameters](#parameters-24)\n*   [MasterRoute](#masterroute)\n    *   [Parameters](#parameters-25)\n    *   [Properties](#properties-3)\n*   [nullGuard](#nullguard)\n*   [RootRoute](#rootroute)\n    *   [hasParams](#hasparams)\n    *   [path](#path-2)\n    *   [propertyMapping](#propertymapping)\n    *   [guard](#guard-1)\n*   [SkeletonRoute](#skeletonroute)\n    *   [Parameters](#parameters-26)\n    *   [Properties](#properties-4)\n    *   [enter](#enter-1)\n        *   [Parameters](#parameters-27)\n    *   [leave](#leave-1)\n        *   [Parameters](#parameters-28)\n    *   [isAcceptable](#isacceptable)\n        *   [Parameters](#parameters-29)\n    *   [propertiesFor](#propertiesfor)\n        *   [Parameters](#parameters-30)\n    *   [commonAncestor](#commonancestor)\n        *   [Parameters](#parameters-31)\n    *   [valueFor](#valuefor)\n        *   [Parameters](#parameters-32)\n    *   [value](#value-1)\n    *   [propertyMapping](#propertymapping-1)\n    *   [objectInstance](#objectinstance)\n*   [ValueStoreRoute](#valuestoreroute)\n*   [SessionData](#sessiondata)\n    *   [Properties](#properties-5)\n*   [msecsRequiredForRefresh](#msecsrequiredforrefresh)\n*   [supportedTokenTypes](#supportedtokentypes)\n*   [Session](#session)\n    *   [Parameters](#parameters-33)\n    *   [Properties](#properties-6)\n    *   [update](#update)\n        *   [Parameters](#parameters-34)\n    *   [refresh](#refresh)\n    *   [authorizationHeader](#authorizationheader)\n    *   [isValid](#isvalid)\n    *   [invalidate](#invalidate)\n    *   [hasEntitlement](#hasentitlement)\n        *   [Parameters](#parameters-35)\n    *   [subscribe](#subscribe-1)\n        *   [Parameters](#parameters-36)\n*   [decode](#decode)\n    *   [Parameters](#parameters-37)\n*   [Transition](#transition)\n    *   [Parameters](#parameters-38)\n    *   [Properties](#properties-7)\n    *   [start](#start)\n    *   [end](#end)\n    *   [redirect](#redirect)\n        *   [Parameters](#parameters-39)\n    *   [abort](#abort-2)\n        *   [Parameters](#parameters-40)\n*   [findClosestAttribute](#findclosestattribute)\n    *   [Parameters](#parameters-41)\n*   [dispatchNavigationEvent](#dispatchnavigationevent)\n    *   [Parameters](#parameters-42)\n*   [nameValueStore](#namevaluestore)\n    *   [Parameters](#parameters-43)\n    *   [Properties](#properties-8)\n*   [WaitingGuard](#waitingguard)\n    *   [Parameters](#parameters-44)\n\n## active\n\n*   **See**: {Router.updateActive}\n\nKeeps the node active state in sync.\n\n### Parameters\n\n*   `node` **[Element](https://developer.mozilla.org/docs/Web/API/Element)**\u0026#x20;\n*   `router` **Router**\u0026#x20;\n\n## Key\n\nKeys also act as svelte stores and can be subscribed.\n\n```js\nexport const article = derived(\n[articles, router.keys.article],\n([$articles, $id], set) =\u003e {\n  set($articles.find(a =\u003e a.id === $id));\n  return () =\u003e {};\n}\n);\n```\n\nType: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)\n\n### Properties\n\n*   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\u0026#x20;\n*   `value` **any**\u0026#x20;\n*   `subscriptions` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)**\u0026#x20;\n\n## BaseRouter\n\n**Extends BaseTransition**\n\nkey subscriptions:\n\n```js\nconst aKey = router.keys.aKey;\n$aKey // fired if value of aKey changes\n```\n\n### Parameters\n\n*   `routes` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\\\u003cRoute\u003e** all managed routes\n*   `base` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** url (optional, default `new URL(\"../\",import.meta.url).pathname`)\n\n### Properties\n\n*   `linkNodes` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)\u003c[Node](https://developer.mozilla.org/docs/Web/API/Node/nextSibling)\u003e** nodes having their active state updated\n*   `routes` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\\\u003cRoute\u003e**\u0026#x20;\n*   `keys` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** collected keys of all routes\n*   `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** value mapping from keys (from current route)\n*   `route` **Route** current\n*   `nested` **[Transition](#transition)** ongoing nested transition\n*   `base` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** url\n\n### component\n\nCurrent component.\nEither from a nested transition or from the current route\n\nReturns **SvelteComponent**\u0026#x20;\n\n### value\n\nValue if the current route\n\nReturns **any**\u0026#x20;\n\n### path\n\nReturns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** url path with fragment \u0026 query\n\n### path\n\nReplace current route.\n\n#### Parameters\n\n*   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\u0026#x20;\n\n### replace\n\nReplace current route without updating the state.\n\n#### Parameters\n\n*   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\u0026#x20;\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** former state\n\n### push\n\nLeave current route and enter route for given path.\nThe work is done by a Transition.\n\n#### Parameters\n\n*   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** where to go\n\nReturns **[Transition](#transition)** running transition\n\n### finalizePush\n\nCalled from a Transition to manifest the new destination.\nIf path is undefined the Transition has been aborderd.\n\n#### Parameters\n\n*   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\u0026#x20;\n\n### continue\n\nContinue a transition to its original destination.\nShortcut for this.transition.continue().\nIf there is no transition ongoing and a fallbackPath is\npresent, it will be entered.\nOtherwise does nothing.\n\n#### Parameters\n\n*   `fallbackPath` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\u0026#x20;\n\n### abort\n\nAbort a transition.\nShortcut for this.transition.abort()\nIf there is no transition ongoing and a fallbackPath is\npresent it will be entered.\nOtherwise does nothing.\n\n#### Parameters\n\n*   `fallbackPath` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\u0026#x20;\n\n### subscribe\n\nRouter subscription.\nChanges in the current route will trigger a update\n\n#### Parameters\n\n*   `subscription` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\u0026#x20;\n\n### updateActive\n\nUpdate the active state of a node.\nA node is considered active if it shared the path prefix with the current route.\n\n#### Parameters\n\n*   `node` **[Element](https://developer.mozilla.org/docs/Web/API/Element)**\u0026#x20;\n\n### addRoute\n\nAdd a new Route.\n\n#### Parameters\n\n*   `route` **Route**\u0026#x20;\n\n### routeFor\n\nFind Route for a given value.\n\n#### Parameters\n\n*   `value` **any**\u0026#x20;\n\nReturns **Route** able to support given value\n\n### pathFor\n\nFind path for a given value.\n\n#### Parameters\n\n*   `value` **any**\u0026#x20;\n*   `suffix` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** to be appended\n\nReturns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** path + suffix\n\n## BaseTransition\n\n### searchParams\n\nDeliver url search params form the current location.\n\nReturns **URLSearchParams** as extracted from the path\n\n### searchParams\n\nReplaces the search part of the path with the given searchParams.\n\n#### Parameters\n\n*   `searchParams` **(URLSearchParams | [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))**\u0026#x20;\n\n### nest\n\nAdd another transition nesting level.\nStarts a transition from the given factory.\n\n#### Parameters\n\n*   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\u0026#x20;\n*   `factory` **[Transition](#transition)**\u0026#x20;\n\n### continue\n\nContinue a nested route to its original destination.\nDoes nothing if the transition has not been nested.\n\n### abort\n\nAbort the transition.\n\n#### Parameters\n\n*   `error` \u0026#x20;\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\u003c[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)\u003e** truen in case there was a nesten transition\n\n## DetailRoute\n\n**Extends ValueStoreRoute**\n\nRoute to represent a slice of the masters list of values.\n\n### Properties\n\n*   `master` **Route** route holding the master records\n\n### master\n\nRoute holding the list ov values\n\nReturns **Route** our master\n\n### first\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\\\u003cany\u003e** 1st. entry\n\n### last\n\nReturns **any** last entry\n\n### previous\n\nReturns **any** previous value\n\n### next\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\\\u003cany\u003e** next value\n\n## Entitlement\n\n### Parameters\n\n*   `data` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))**\u0026#x20;\n\n## Guard\n\nEnforces conditions of routes\nLike the presents of values in the context\n\n### enter\n\nCalled while entering a route (current outlet is not yet set)\n\n#### Parameters\n\n*   `transition` **[Transition](#transition)**\u0026#x20;\n\n### leave\n\nCalled before leaving a route\n\n#### Parameters\n\n*   `transition` **[Transition](#transition)**\u0026#x20;\n\n## redirectGuard\n\nRedirects to a given path if condition is met.\n\n### Parameters\n\n*   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\u0026#x20;\n*   `condition` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** redirects when returning true\n\n## sequenceGuard\n\nExecute guards in a sequence.\n\n### Parameters\n\n*   `children` **Iterable\u003c[Guard](#guard)\u003e**\u0026#x20;\n\n## parallelGuard\n\nExecute guards in a parallel.\n\n### Parameters\n\n*   `children` **Iterable\u003c[Guard](#guard)\u003e**\u0026#x20;\n\n## websocketStore\n\nCreate a writable store based on a web-socket.\nData is transferred as JSON.\nKeeps socket open (reopens if closed) as long as there are subscriptions.\n\n### Parameters\n\n*   `url` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the WebSocket url\n*   `initialValue` **any** store value used before 1st. response from server is present\n*   `socketOptions` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\u003c[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)\u003e** transparently passed to the WebSocket constructor\n\nReturns **Store**\u0026#x20;\n\n## login\n\nBring session into the valid state by calling the authorization endpoint\nand asking for a access\\_token.\nExecutes a POST on the endpoint url expecting username, and password as json\n\n### Parameters\n\n*   `session` **[Session](#session)** to be opened\n*   `endpoint` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** authorization url\n*   `username` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** id of the user\n*   `password` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** user credentials\n*   `tokenmap` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** token names in response to internal known values (optional, default `defaultTokenMap`)\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\u003c([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))\u003e** error message in case of failure or undefined on success\n\n## handleFailedResponse\n\nExtract error description from response.\n\n### Parameters\n\n*   `response` **[Response](https://developer.mozilla.org/docs/Web/Guide/HTML/HTML5)**\u0026#x20;\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\u003c[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)\u003e**\u0026#x20;\n\n## MasterRoute\n\n**Extends SkeletonRoute**\n\nRoute holding a ordered collection of values.\n\n### Parameters\n\n*   `path` \u0026#x20;\n*   `options` \u0026#x20;\n\n### Properties\n\n*   `value` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\\\u003cany\u003e**\u0026#x20;\n\n## nullGuard\n\nDefault empty guard does nothing.\n\n## RootRoute\n\nRoute at the root of the tree.\nThis route has no parent.\nAll other routes are below of this one.\n\n### hasParams\n\nAre there parameters in the path.\n\nReturns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if route has parameters (:key)\n\n### path\n\nReturns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** empty as we are the root\n\n### propertyMapping\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** empty object\n\n### guard\n\nReturns **[Guard](#guard)** empty guard which does nothing\n\n## SkeletonRoute\n\n**Extends RootRoute**\n\nRoute\nSubscriptions on Routes fire when the route value changes.\n\n### Parameters\n\n*   `path` \u0026#x20;\n*   `options`   (optional, default `{}`)\n\n### Properties\n\n*   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** full path of the Route including all parents\n*   `component` **SvelteComponent** target to show\n*   `linkComponent` **SvelteComponent** content for [ObjectLink](ObjectLink)\n*   `propertyMapping` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Map properties to object attributes\n    Keys are the property names and values are the keys in the resulting object.\n*   `priority` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n*   `keys` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\u003c[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)\u003e** as found in the path\n*   `regex` **RegEx**\u0026#x20;\n*   `value` **any**\u0026#x20;\n\n### enter\n\nEnter the route from a former one.\nAll parent routes up to the common ancestor are entered first.\n\n#### Parameters\n\n*   `transition` **[Transition](#transition)**\u0026#x20;\n*   `untilRoute` **Route** the common ancestor with the former route\n\n### leave\n\nLeave the route to a new one.\nAll parent routes up to the common ancestor are left.\n\n#### Parameters\n\n*   `transition` **[Transition](#transition)**\u0026#x20;\n*   `untilRoute` **Route** the common ancestor with the future route\n\n### isAcceptable\n\nCheck if value and properties are acceptable for the route.\n\n#### Parameters\n\n*   `value` **any** to be placed into route\n*   `properties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** as presented in the route\n\nReturns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if value can be accepted\n\n### propertiesFor\n\nExtract properties from a value.\nAll property values must be strings.\n\n#### Parameters\n\n*   `value` **any** source of the properties\n\nReturns **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** properties extracted from given value\n\n### commonAncestor\n\nFind common ancestor with an other Route.\n\n#### Parameters\n\n*   `other` **Route**\u0026#x20;\n\nReturns **(Route | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** common ancestor Route between receiver and other\n\n### valueFor\n\nDeliver value for a given set of properties of the transition.\nDefault implemantation asks the parent route.\n\n#### Parameters\n\n*   `transition` **[Transition](#transition)**\u0026#x20;\n\nReturns **any** for matching properties\n\n### value\n\nDeliver route value.\nDefault implemantation asks the parent route.\n\nReturns **any**\u0026#x20;\n\n### propertyMapping\n\nDeliver property mapping.\nDefault implemantation asks the parent route.\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** for matching properties\n\n### objectInstance\n\nDefault implemantation asks the parent route.\n\n## ValueStoreRoute\n\n**Extends SkeletonRoute**\n\nRoute holding a single value\n\n## SessionData\n\nData as preserved in the backing store.\n\nType: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)\n\n### Properties\n\n*   `username` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** user name (id)\n*   `access_token` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** JWT token\n*   `refresh_token` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** JWT token\n\n## msecsRequiredForRefresh\n\nTime required to execute a refresh\n\nType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)\n\n## supportedTokenTypes\n\n## Session\n\nUser session.\nTo create as session backed by browser local storage.\n\n```js\nlet session = new Session(localStorage);\n```\n\nor by browser session storage\n\n```js\nlet session = new Session(sessionStorage);\n```\n\n### Parameters\n\n*   `store` **[SessionData](#sessiondata)**  (optional, default `localStorage`)\n\n### Properties\n\n*   `entitlements` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)\u003c[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)\u003e**\u0026#x20;\n*   `subscriptions` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)\u003c[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)\u003e** store subscriptions\n*   `expirationDate` **[Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)** when the access token expires\n*   `access_token` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** token itself\n*   `refresh_token` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** refresh token\n\n### update\n\nConsume auth response data and reflect internal state.\n\n#### Parameters\n\n*   `data` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\u0026#x20;\n\n### refresh\n\nRefresh with refresh\\_token.\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\u003c[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)\u003e** true if refresh was succcessfull false otherwise\n\n### authorizationHeader\n\nHttp header suitable for fetch.\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** header The http header.\n\nReturns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** header.Authorization The Bearer access token.\n\n### isValid\n\nAs long as the expirationTimer is running we must be valid.\n\nReturns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if session is valid (not expired)\n\n### invalidate\n\nRemove all tokens from the session and the backing store.\n\n### hasEntitlement\n\nCheck presence of an entitlement.\n\n#### Parameters\n\n*   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** of the entitlement\n\nReturns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if the named entitlement is present\n\n### subscribe\n\nFired when the session changes.\n\n#### Parameters\n\n*   `subscription` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\u0026#x20;\n\n## decode\n\nExtract and decode the payload.\n\n### Parameters\n\n*   `token` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\u0026#x20;\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** payload object\n\n## Transition\n\n**Extends BaseTransition**\n\nTransition between routes.\n\n### Parameters\n\n*   `router` **Router**\u0026#x20;\n*   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** new destination\n\n### Properties\n\n*   `router` **Router**\u0026#x20;\n*   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** new destination\n\n### start\n\nStart the transition\n\n*   leave old route\n*   find matching target route @see matcher()\n*   enter new route\n*   set params\n*   set current route\n\n### end\n\n*   **See**: Router.finalizePush\n\nCleanup transition.\nUpdate Nodes active state\n\n### redirect\n\nHalt current transition and go to another route.\nTo proceed with the original route call [continue()](continue\\(\\))\nThe original transition will keept in place and can be continued afterwards.\n\n#### Parameters\n\n*   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** new route to enter temporary\n\n### abort\n\nBring back the router into the state before the transition has started.\nAll nested transitions also will be termniated.\n\n#### Parameters\n\n*   `e` **(Exception | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**\u0026#x20;\n\n## findClosestAttribute\n\nWalks up the dom tree parents unti a node with a given attribute is found or the root node is reached.\n\n### Parameters\n\n*   `element` **[Element](https://developer.mozilla.org/docs/Web/API/Element)**\u0026#x20;\n*   `attributeName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\u0026#x20;\n\nReturns **([Element](https://developer.mozilla.org/docs/Web/API/Element) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**\u0026#x20;\n\n## dispatchNavigationEvent\n\nDispatches a NAVIGATION\\_EVENT with pathname and hash\n\n### Parameters\n\n*   `event` **[Event](https://developer.mozilla.org/docs/Web/API/Event)**\u0026#x20;\n\n## nameValueStore\n\nCreate a named object which also acts as a store.\n\n### Parameters\n\n*   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\u0026#x20;\n*   `value` **any** initial value\n\n### Properties\n\n*   `value` **any**\u0026#x20;\n\nReturns **Store**\u0026#x20;\n\n## WaitingGuard\n\n**Extends Guard**\n\nShows a component during transition.\n\n### Parameters\n\n*   `component` **SvelteComponent** to show up during th transition\n*   `rampUpTime` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** initial delay for the componnt to show up (optional, default `300`)\n\n# install\n\nWith [npm](http://npmjs.org) do:\n\n```shell\nnpm install svelte-websocket-store\n```\n\nWith [yarn](https://yarnpkg.com) do:\n\n```shell\nyarn add svelte-websocket-store\n```\n\n## run tests\n\n```sh\nexport BROWSER=safari|chrome|...\nnpm|yarn test\n```\n\n# license\n\nBSD-2-Clause\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farlac77%2Fsvelte-websocket-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farlac77%2Fsvelte-websocket-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farlac77%2Fsvelte-websocket-store/lists"}