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

deep-state-observer

Package Overview
Dependencies
Maintainers
1
Versions
225
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deep-state-observer - npm Package Compare versions

Comparing version 4.1.13 to 4.1.14

2

index.ts

@@ -254,3 +254,3 @@ import WildcardObject from "./wildcard-object-scan";

experimentalMatch: false,
useObjectMaps: true,
useObjectMaps: false,
useProxy: false,

@@ -257,0 +257,0 @@ maxSimultaneousJobs: 1000,

{
"name": "deep-state-observer",
"version": "4.1.13",
"version": "4.1.14",
"description": "Deep state observer is an state management library that will fire listeners only when specified object node (which also can be a wildcard) was changed.",

@@ -5,0 +5,0 @@ "main": "index.cjs.js",

@@ -87,61 +87,2 @@ [![GitHub license](https://img.shields.io/github/license/neuronetio/deep-state-observer?style=flat-square)](https://github.com/neuronetio/deep-state-observer/blob/master/LICENSE)

## Update and proxy
You can use proxy instead of `state.update` function.
Proxy is better because values are linted;
```js
const state = new State({ x: { y: { z: 10 } } });
state.update("x.y.z", 20);
// is equivalent of
state.proxy.x.y.z = 20;
// is equivalent of (state.$$$ is just shorthand for state.proxy)
state.$$$.x.y.z = 20;
// and with function
state.update("x.y.z", (value) => {
return value + 10;
});
// is equivalent of
state.proxy.x.y.z = (value) => {
return value + 10;
};
// is equivalent of
state.$$$.x.y.z = (value) => {
return value + 10;
};
```
## All objects and arrays are reactive (proxies)
```js
const state = new State({ x: { y: { z: 10 } } });
let counter = 0;
state.subscribe("x.y.z", () => {
counter++;
});
// counter === 1
// x.y.z === 10
const z = state.get("x.y.z");
z = 20;
// counter === 1
// x.y.z === 10 because it is not an object or array
const y = state.get("x.y"); // object
y.z = 20; // change detected
// counter === 2
// x.y.z === 20
state.proxy.x = { y: { z: 30 } };
// counter === 3
// x.y.z === 30
```
## Wildcards

@@ -501,3 +442,3 @@

## group
## group - very useful if you want to join couple of changes into one

@@ -504,0 +445,0 @@ With subscribeAll you can group listeners to fire only once if one of the path is changed.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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