svelte-broadcastable
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

svelte-broadcastable

Svelte broadcastable is a store wrapper for the Broadcast Channel API. It syncs any data across a given channel.

https://github.com/Hugos68/svelte-broadcastable/assets/63101006/74d205be-eeb6-40da-b778-7ca9c43c2666

Usage

You can import the broadcastable store like so:

import { broadcastable } from 'svelte-broadcastable';

You can use the store like this:

const init = 'hello';

const store = broadcastable('my-channel', init);

The API is identical to the svelte writable store except that it adds 1 parameter called name, this will be the name that is used to instantiate the BroadcastChannel, this allows for using multiple channels when sharing state.

Readme

Keywords

none

Package Sidebar

Install

npm i svelte-broadcastable

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

4.17 kB

Total Files

4

Last publish

Collaborators

  • hugokorte