@nanostores/preact
Advanced tools
Comparing version 0.1.2 to 0.1.3
12
index.js
@@ -17,7 +17,7 @@ import { useState, useEffect } from 'preact/hooks' | ||
useEffect(() => { | ||
let batching | ||
let batching, timer, unlisten | ||
let rerender = () => { | ||
if (!batching) { | ||
batching = 1 | ||
setTimeout(() => { | ||
timer = setTimeout(() => { | ||
batching = undefined | ||
@@ -29,6 +29,10 @@ forceRender({}) | ||
if (opts.keys) { | ||
return listenKeys(store, opts.keys, rerender) | ||
unlisten = listenKeys(store, opts.keys, rerender) | ||
} else { | ||
return store.listen(rerender) | ||
unlisten = store.listen(rerender) | ||
} | ||
return () => { | ||
unlisten() | ||
clearTimeout(timer) | ||
} | ||
}, [store, '' + opts.keys]) | ||
@@ -35,0 +39,0 @@ |
{ | ||
"name": "@nanostores/preact", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Preact integration for Nano Stores, a tiny state manager with many atomic tree-shakable stores", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5191
93