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

stook

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stook - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

4

dist/stook.cjs.development.js

@@ -118,2 +118,4 @@ 'use strict';

var isBrowser = typeof window === 'object' && typeof document === 'object' && document.nodeType === 9;
var useSafeLayoutEffect = isBrowser ? react.useLayoutEffect : react.useEffect;
/**

@@ -146,3 +148,3 @@ * Returns a stateful value, similar to useState, but need a key;

react.useLayoutEffect(function () {
useSafeLayoutEffect(function () {
setters.push(set);

@@ -149,0 +151,0 @@ emitStoreInit(key);

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e,n=require("react"),r=require("immer"),o=(t=require("mitt"))&&"object"==typeof t&&"default"in t?t.default:t,u=function(){function t(){}return t.set=function(e,n){var r=t.stores[e];r&&r.setState||(t.stores[e]=n)},t.get=function(e){return t.stores[e]},t}();u.stores={},function(t){t.STORE_INITED="STORE_INITED",t.STORE_UPDATED="STORE_UPDATED"}(e||(e={}));var s=o(),i=function(){function t(t){var n=this;this.setters=[],this.setState=function(t,r,o){var u=n.getNextState(r,o);return n.state=u,s.emit(e.STORE_UPDATED,{key:t,nextState:u}),n.state=u,n.setters.forEach((function(t){return t(u)})),u},this.state=t}return t.prototype.getNextState=function(t,e){var n;if("function"!=typeof e)return e;if("object"!=typeof t)return e(t);var o=!0,u=r.produce(t,(function(t){var r=e(t);r!==t&&r&&"object"==typeof r&&(n=r,o=!1)}));return o&&(n=u),n},t}();exports.Storage=u,exports.getState=function(t){var e=u.get(t);return e?e.state:void 0},exports.mutate=function(t,e){var n=u.get(t);n&&n.setState?n.setState(t,n.state,e):u.set(t,{state:e})},exports.onStoreInit=function(t){s.on(e.STORE_INITED,(function(e){t(e)}))},exports.onStoreUpdate=function(t){s.on(e.STORE_UPDATED,(function(e){t(e)}))},exports.useStore=function(t,r){var o=u.get(t),f=o?o.state:r;u.set(t,new i(f));var a=u.get(t),c=n.useState(f),S=c[0],E=c[1],p=a.setters;return n.useLayoutEffect((function(){p.push(E),function(t){s.emit(e.STORE_INITED,t)}(t)}),[]),n.useEffect((function(){return function(){p.splice(p.indexOf(E),1)}}),[]),[S,function(t){return function(e){return a.setState(t,S,e)}}(t)]};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e,n=require("react"),r=require("immer"),o=(t=require("mitt"))&&"object"==typeof t&&"default"in t?t.default:t,u=function(){function t(){}return t.set=function(e,n){var r=t.stores[e];r&&r.setState||(t.stores[e]=n)},t.get=function(e){return t.stores[e]},t}();u.stores={},function(t){t.STORE_INITED="STORE_INITED",t.STORE_UPDATED="STORE_UPDATED"}(e||(e={}));var s=o(),i=function(){function t(t){var n=this;this.setters=[],this.setState=function(t,r,o){var u=n.getNextState(r,o);return n.state=u,s.emit(e.STORE_UPDATED,{key:t,nextState:u}),n.state=u,n.setters.forEach((function(t){return t(u)})),u},this.state=t}return t.prototype.getNextState=function(t,e){var n;if("function"!=typeof e)return e;if("object"!=typeof t)return e(t);var o=!0,u=r.produce(t,(function(t){var r=e(t);r!==t&&r&&"object"==typeof r&&(n=r,o=!1)}));return o&&(n=u),n},t}(),f="object"==typeof window&&"object"==typeof document&&9===document.nodeType?n.useLayoutEffect:n.useEffect;exports.Storage=u,exports.getState=function(t){var e=u.get(t);return e?e.state:void 0},exports.mutate=function(t,e){var n=u.get(t);n&&n.setState?n.setState(t,n.state,e):u.set(t,{state:e})},exports.onStoreInit=function(t){s.on(e.STORE_INITED,(function(e){t(e)}))},exports.onStoreUpdate=function(t){s.on(e.STORE_UPDATED,(function(e){t(e)}))},exports.useStore=function(t,r){var o=u.get(t),c=o?o.state:r;u.set(t,new i(c));var a=u.get(t),S=n.useState(c),p=S[0],E=S[1],T=a.setters;return f((function(){T.push(E),function(t){s.emit(e.STORE_INITED,t)}(t)}),[]),n.useEffect((function(){return function(){T.splice(T.indexOf(E),1)}}),[]),[p,function(t){return function(e){return a.setState(t,p,e)}}(t)]};
//# sourceMappingURL=stook.cjs.production.min.js.map

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

import { useState, useLayoutEffect, useEffect } from 'react';
import { useState, useEffect, useLayoutEffect } from 'react';
import { produce } from 'immer';

@@ -112,2 +112,4 @@ import mitt from 'mitt';

var isBrowser = typeof window === 'object' && typeof document === 'object' && document.nodeType === 9;
var useSafeLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
/**

@@ -140,3 +142,3 @@ * Returns a stateful value, similar to useState, but need a key;

useLayoutEffect(function () {
useSafeLayoutEffect(function () {
setters.push(set);

@@ -143,0 +145,0 @@ emitStoreInit(key);

{
"name": "stook",
"version": "1.5.0",
"version": "1.5.1",
"description": "A minimalist design state management library for React",

@@ -29,3 +29,3 @@ "license": "MIT",

},
"gitHead": "9d16041aaab2c22dd68f955595353d49360fee2b"
"gitHead": "889786c6b2ec6de9c041495e70b770aab50c577d"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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