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

nanostores

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nanostores - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

2

clean-stores/index.d.ts

@@ -9,2 +9,4 @@ import { MapBuilder, AnySyncBuilder } from '../define-map/index.js'

*
* It also reset all effects by calling {@link cleanEffects}.
*
* ```js

@@ -11,0 +13,0 @@ * import { cleanStores } from 'nanostores'

@@ -0,1 +1,3 @@

import { clearEffects } from '../effect/index.js'
export const clean = Symbol('clean')

@@ -9,2 +11,3 @@

}
clearEffects()
for (let store of stores) {

@@ -11,0 +14,0 @@ if (store) {

@@ -59,1 +59,15 @@ /**

export function allEffects(): Promise<void>
/**
* Forget all tracking effects. Use it only for tests.
* {@link cleanStores} cleans effects automatically.
*
* ```js
* import { cleanEffects } from 'nanostores'
*
* afterEach(() => {
* cleanEffects()
* })
* ```
*/
export function clearEffects(): void

18

effect/index.js

@@ -9,3 +9,5 @@ let effects = 0

if (effects === 0) {
for (let i of resolves) i()
let prevResolves = resolves
resolves = []
for (let i of prevResolves) i()
}

@@ -15,11 +17,5 @@ }

export async function effect(cb) {
export function effect(cb) {
let endEffect = startEffect()
let result
try {
result = await cb()
} finally {
endEffect()
}
return result
return cb().finally(endEffect)
}

@@ -36,1 +32,5 @@

}
export function clearEffects() {
effects = 0
}

@@ -13,3 +13,8 @@ export {

} from './create-store/index.js'
export { startEffect, effect, allEffects } from './effect/index.js'
export {
clearEffects,
startEffect,
allEffects,
effect
} from './effect/index.js'
export { createMap, MapStore } from './create-map/index.js'

@@ -16,0 +21,0 @@ export { clean, cleanStores } from './clean-stores/index.js'

@@ -1,2 +0,7 @@

export { startEffect, effect, allEffects } from './effect/index.js'
export {
clearEffects,
startEffect,
allEffects,
effect
} from './effect/index.js'
export { clean, cleanStores } from './clean-stores/index.js'

@@ -3,0 +8,0 @@ export { update, updateKey } from './update/index.js'

{
"name": "nanostores",
"version": "0.4.2",
"version": "0.4.3",
"description": "A tiny (172 bytes) state manager for React/Preact/Vue/Svelte with many atomic tree-shakable stores",

@@ -5,0 +5,0 @@ "keywords": [

@@ -10,3 +10,3 @@ # Nano Stores

* **Small.** between 172 and 527 bytes (minified and gzipped).
* **Small.** between 172 and 526 bytes (minified and gzipped).
Zero dependencies. It uses [Size Limit] to control size.

@@ -13,0 +13,0 @@ * **Fast.** With small atomic and derived stores, you do not need to call

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