Socket
Socket
Sign inDemoInstall

proxy-state-tree

Package Overview
Dependencies
Maintainers
1
Versions
865
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

proxy-state-tree - npm Package Compare versions

Comparing version 1.0.0-alpha7 to 1.0.0-alpha8

2

package.json
{
"name": "proxy-state-tree",
"version": "1.0.0-alpha7",
"version": "1.0.0-alpha8",
"description": "An implementation of the Mobx/Vue state tracking approach, for library authors",

@@ -5,0 +5,0 @@ "main": "dist/proxy-state-tree.cjs.js",

@@ -33,3 +33,3 @@ # proxy-state-tree

You can track access to the state by using the **startPathsTracking** and **stopPathsTracking** methods.
You can track access to the state by using the **startPathsTracking** and **clearPathsTracking** methods.

@@ -45,6 +45,6 @@ ```js

tree.startPathsTracking()
const trackId = tree.startPathsTracking()
const foo = state.foo
const bar = state.bar
const paths = tree.stopPathsTracking()
const paths = tree.clearPathsTracking(trackId)

@@ -54,3 +54,3 @@ console.log(paths) // ['foo', 'bar']

You would typically use this mechanism to track usage of state. For example rendering a component, calculating a a computed value etc. The returned paths array is stored for later usage. The paths structure is used internally by proxy-state-tree, but you can also consume it as a library author to for example showing components and what paths they depend on in a devtool. Nested paths uses dot notation, for example `['foo.bar']`.
You would typically use this mechanism to track usage of state. For example rendering a component, calculating a a computed value etc. The returned paths array is stored for later usage. The paths structure is used internally by proxy-state-tree, but you can also consume it as a library author to for example showing components and what paths they depend on in a devtool. Nested paths uses dot notation, for example `['foo.bar']`. Path tracking can be nested, but they can not run at the same time. Meaning the nested tracking must finish before the outer tracker.

@@ -71,3 +71,3 @@ ## Track mutations

state.bar.push('baz')
const mutations = tree.stopMutationTracking()
const mutations = tree.clearMutationTracking()

@@ -88,3 +88,3 @@ console.log(mutations)

You would use **startMutationTracking** and **stopMutationTracking** around logic that is allowed to do mutations, for example actions or similar. Trying to mutate without this tracking active results in an error. The returned array can be used in combination with a devtool.
You would use **startMutationTracking** and **clearMutationTracking** around logic that is allowed to do mutations, for example actions or similar. Trying to mutate without this tracking active results in an error. The returned array can be used in combination with a devtool.

@@ -103,7 +103,7 @@ ## Check need to update

function render () {
tree.startPathsTracking()
const trackId = tree.startPathsTracking()
const foo = state.foo
const bar = state.bar
return tree.stopPathsTracking()
return tree.clearPathsTracking(trackId)
}

@@ -123,3 +123,3 @@

state.bar.push('baz')
tree.stopMutationTracking()
tree.clearMutationTracking()

@@ -134,3 +134,3 @@ // This command flushes out the current mutations and

Here we combine the tracked paths with the mutations performed to see if this components, computed or whatever indeed needs to run again, doing a new **startPathsTracking** and **stopPathsTracking**.
Here we combine the tracked paths with the mutations performed to see if this components, computed or whatever indeed needs to run again, doing a new **startPathsTracking** and **clearPathsTracking**.

@@ -137,0 +137,0 @@ ## Dynamic state values

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