mobx-utils
Advanced tools
Comparing version 3.2.0-rc.4 to 3.2.0
{ | ||
"name": "mobx-utils", | ||
"version": "3.2.0-rc.4", | ||
"version": "3.2.0", | ||
"description": "Utility functions and common patterns for MobX", | ||
"main": "mobx-utils.umd.js", | ||
"module": "mobx-utils.module.js", | ||
"jsnext:main": "mobx-utils.module.js", | ||
"react-native": "mobx-utils.module.js", | ||
@@ -62,2 +63,2 @@ "typings": "lib/mobx-utils.d.ts", | ||
] | ||
} | ||
} |
@@ -332,2 +332,6 @@ # MobX-utils | ||
MobX normally suspends any computed value that is not in use by any reaction, | ||
and lazily re-evaluates the expression if needed outside a reaction while not in use. | ||
`keepAlive` marks a computed value as always in use, meaning that it will always fresh, but never disposed automatically. | ||
**Parameters** | ||
@@ -337,3 +341,4 @@ | ||
- `_2` | ||
- `computedValue` **IComputedValue<any>** created using the `computed` function | ||
- `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** an object that has a computed property, created by `@computed` or `extendObservable` | ||
- `property` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the name of the property to keep alive | ||
@@ -343,8 +348,7 @@ **Examples** | ||
```javascript | ||
const number = observable(3) | ||
const doubler = computed(() => number.get() * 2) | ||
const stop = keepAlive(doubler) | ||
// doubler will now stay in sync reactively even when there are no further observers | ||
stop() | ||
// normal behavior, doubler results will be recomputed if not observed but needed, but lazily | ||
const obj = observable({ | ||
number: 3, | ||
doubler: function() { return this.number * 2 } | ||
}) | ||
const stop = keepAlive(obj, "doubler") | ||
``` | ||
@@ -356,6 +360,2 @@ | ||
MobX normally suspends any computed value that is not in use by any reaction, | ||
and lazily re-evaluates the expression if needed outside a reaction while not in use. | ||
`keepAlive` marks a computed value as always in use, meaning that it will always fresh, but never disposed automatically. | ||
**Parameters** | ||
@@ -365,4 +365,3 @@ | ||
- `_2` | ||
- `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** an object that has a computed property, created by `@computed` or `extendObservable` | ||
- `property` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the name of the property to keep alive | ||
- `computedValue` **IComputedValue<any>** created using the `computed` function | ||
@@ -372,7 +371,8 @@ **Examples** | ||
```javascript | ||
const obj = observable({ | ||
number: 3, | ||
doubler: function() { return this.number * 2 } | ||
}) | ||
const stop = keepAlive(obj, "doubler") | ||
const number = observable(3) | ||
const doubler = computed(() => number.get() * 2) | ||
const stop = keepAlive(doubler) | ||
// doubler will now stay in sync reactively even when there are no further observers | ||
stop() | ||
// normal behavior, doubler results will be recomputed if not observed but needed, but lazily | ||
``` | ||
@@ -379,0 +379,0 @@ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
214356
1