mobx-utils
Advanced tools
Comparing version
/** | ||
* Disposes of all the internal Observables created by invocations of `now()`. | ||
* | ||
* The use case for this is to ensure that unit tests can run independent of each other. | ||
* You should not call this in regular application code. | ||
* | ||
* @example | ||
* afterEach(() => { | ||
* utils.resetNowInternalState() | ||
* }) | ||
*/ | ||
export declare function resetNowInternalState(): void; | ||
/** | ||
* Returns the current date time as epoch number. | ||
@@ -3,0 +15,0 @@ * The date time is read from an observable which is updated automatically after the given interval. |
@@ -5,2 +5,20 @@ import { _isComputingDerivation } from "mobx"; | ||
/** | ||
* Disposes of all the internal Observables created by invocations of `now()`. | ||
* | ||
* The use case for this is to ensure that unit tests can run independent of each other. | ||
* You should not call this in regular application code. | ||
* | ||
* @example | ||
* afterEach(() => { | ||
* utils.resetNowInternalState() | ||
* }) | ||
*/ | ||
export function resetNowInternalState() { | ||
for (var _i = 0, _a = Object.getOwnPropertyNames(tickers); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
tickers[key].dispose(); | ||
delete tickers[key]; | ||
} | ||
} | ||
/** | ||
* Returns the current date time as epoch number. | ||
@@ -7,0 +25,0 @@ * The date time is read from an observable which is updated automatically after the given interval. |
{ | ||
"name": "mobx-utils", | ||
"version": "6.0.7", | ||
"version": "6.0.8", | ||
"description": "Utility functions and common patterns for MobX", | ||
@@ -94,2 +94,2 @@ "main": "mobx-utils.umd.js", | ||
} | ||
} | ||
} |
@@ -62,8 +62,10 @@ # MobX-utils | ||
- [Examples](#examples-9) | ||
- [resetNowInternalState](#resetnowinternalstate) | ||
- [Examples](#examples-10) | ||
- [now](#now) | ||
- [Parameters](#parameters-11) | ||
- [Examples](#examples-10) | ||
- [Examples](#examples-11) | ||
- [expr](#expr) | ||
- [Parameters](#parameters-12) | ||
- [Examples](#examples-11) | ||
- [Examples](#examples-12) | ||
- [createTransformer](#createtransformer) | ||
@@ -73,6 +75,6 @@ - [Parameters](#parameters-13) | ||
- [Parameters](#parameters-14) | ||
- [Examples](#examples-12) | ||
- [Examples](#examples-13) | ||
- [ObservableGroupMap](#observablegroupmap) | ||
- [Parameters](#parameters-15) | ||
- [Examples](#examples-13) | ||
- [Examples](#examples-14) | ||
- [ObservableMap](#observablemap) | ||
@@ -86,3 +88,3 @@ - [defineProperty](#defineproperty) | ||
- [Parameters](#parameters-16) | ||
- [Examples](#examples-14) | ||
- [Examples](#examples-15) | ||
- [DeepMapEntry](#deepmapentry) | ||
@@ -509,2 +511,17 @@ - [DeepMap](#deepmap) | ||
## resetNowInternalState | ||
Disposes of all the internal Observables created by invocations of `now()`. | ||
The use case for this is to ensure that unit tests can run independent of each other. | ||
You should not call this in regular application code. | ||
### Examples | ||
```javascript | ||
afterEach(() => { | ||
utils.resetNowInternalState() | ||
}) | ||
``` | ||
## now | ||
@@ -511,0 +528,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
6567
1.03%921
1.88%314551
-3.21%53
-1.85%