Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svelte-store2

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-store2

Extended Svelte stores with additional methods.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-20%
Maintainers
1
Weekly downloads
 
Created
Source

Svelte store2

Sometimes you need to get the value of a store outside of a component or store that you are not subscribed to. Svelte provides a get() function for this, but it works by creating a temporary subscription, which may not be what you expect.

Store2 provides writable2, derived2 and readable2 stores, each with a get() method to retrieve the current store value.

Usage

Install the package:

npm install --save-dev svelte-store2

Then you can just replace the original Svelte stores with writable2, derived2 or readable2 and benefit from using the get() method:

import {writable2, derived2} from 'svelte-store2';

const w = writable2(0);
const d = derived2(w, $w => $w * 2);

w.get();  // 0
d.get();  // 0

w.set(2);
w.get();  // 2
d.get();  // 4

Keywords

FAQs

Package last updated on 16 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc