Socket
Socket
Sign inDemoInstall

simpler-state

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simpler-state - npm Package Compare versions

Comparing version 1.0.0-rc.0 to 1.0.0-rc.1

10

es/entity.js

@@ -25,4 +25,3 @@ import { store } from './store';

var entity = {
_value: initialValue,
_initialValue: initialValue,
_value: undefined,
_subscribers: []

@@ -37,6 +36,7 @@ };

entity.getInitialValue = function () {
return entity._initialValue;
}; // Save reference to this entity for use with useEntityBoundary hook
entity.init = function () {
entity.set(initialValue);
};
entity.init(); // Save reference to this entity for use with useEntityBoundary hook

@@ -43,0 +43,0 @@ store.push(entity);

@@ -7,3 +7,3 @@ import { useEffect } from 'react';

for (var i = 0; i < store.length; i++) {
store[i]._value = store[i]._initialValue;
store[i].init();
}

@@ -10,0 +10,0 @@ };

@@ -26,2 +26,3 @@ /**

export interface Entity<T> {
init: () => T
get: () => T

@@ -42,9 +43,1 @@ set: (

export function shallowEqual(a: any, b: any): boolean
export interface Plugin {
onCreate: () => void
onFirstUse: () => void
beforeSet: () => void
afterSet: () => void
onDestroy: () => void
}

@@ -34,4 +34,3 @@ "use strict";

var entity = {
_value: initialValue,
_initialValue: initialValue,
_value: undefined,
_subscribers: []

@@ -46,6 +45,7 @@ };

entity.getInitialValue = function () {
return entity._initialValue;
}; // Save reference to this entity for use with useEntityBoundary hook
entity.init = function () {
entity.set(initialValue);
};
entity.init(); // Save reference to this entity for use with useEntityBoundary hook

@@ -52,0 +52,0 @@ _store.store.push(entity);

@@ -16,3 +16,3 @@ "use strict";

for (var i = 0; i < _store["default"].length; i++) {
_store["default"][i]._value = _store["default"][i]._initialValue;
_store["default"][i].init();
}

@@ -19,0 +19,0 @@ };

{
"name": "simpler-state",
"version": "1.0.0-rc.0",
"version": "1.0.0-rc.1",
"description": "The simplest app state management for React",

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

@@ -75,1 +75,5 @@ # <img src="https://simpler-state.js.org/assets/simpler-state-logo.png" alt="SimpleR State" width="240"/>

And if you like this library, the concept, and its simplicity, [please give it a star on GitHub](https://github.com/arnelenero/simpler-state) to let me know. 😀
## Prior Art
This library is an evolution of the already production-tested [react-entities](https://github.com/arnelenero/react-entities) that I also wrote. It shares the same stable core, but with a very different API.
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