effector-inspector
Advanced tools
Comparing version 0.13.0 to 0.14.0
@@ -1,2 +0,2 @@ | ||
import { Effect, Event, Store } from 'effector'; | ||
import { Domain, Effect, Event, Store, Unit } from 'effector'; | ||
import { Inspector, Options } from './types.h'; | ||
@@ -16,1 +16,36 @@ export declare function createInspector(options?: Options): Inspector | undefined; | ||
}): void; | ||
/** | ||
* | ||
* Attaches inspector to provided units | ||
* | ||
* @param root {Unit<any>[]} - units to attach inspector to | ||
*/ | ||
export declare function attachInspector(targets: Unit<any>[]): void; | ||
/** | ||
* | ||
* Attaches inspector to provided effect. | ||
* | ||
* @param root {Store} - effect to attach inspector to | ||
*/ | ||
export declare function attachInspector(target: Effect<any, any, any>): void; | ||
/** | ||
* | ||
* Attaches inspector to provided event. | ||
* | ||
* @param root {Event} - event to attach inspector to | ||
*/ | ||
export declare function attachInspector(target: Event<any>): void; | ||
/** | ||
* | ||
* Attaches inspector to provided store. | ||
* | ||
* @param root {Store} - store to attach inspector to | ||
*/ | ||
export declare function attachInspector(target: Store<any>): void; | ||
/** | ||
* | ||
* Attaches inspector to provided domain - all units inside will be tracked | ||
* | ||
* @param root {Domain} - domain to attach inspector to | ||
*/ | ||
export declare function attachInspector(root: Domain): void; |
{ | ||
"name": "effector-inspector", | ||
"version": "0.13.0", | ||
"version": "0.14.0", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "module": "index.mjs", |
@@ -9,2 +9,67 @@ # Effector Inspector | ||
## Standalone | ||
1. Install **effector-inspector** | ||
```bash | ||
npm install --dev effector-inspector | ||
``` | ||
or | ||
```bash | ||
yarn add -D effector-inspector | ||
``` | ||
2. Make sure, that you have either [`effector/babel-plugin`](https://effector.dev/docs/api/effector/babel-plugin/) or [`@effector/swc-plugin`](https://github.com/effector/swc-plugin) set up in your project. These plugins add metadata to all effector's units, which is then used by effector-inspector. | ||
Check out the documentation of [`effector/babel-plugin`](https://effector.dev/docs/api/effector/babel-plugin/) or [`@effector/swc-plugin`](https://github.com/effector/swc-plugin). | ||
3. Initialize `inspector` in your application's entrypoint (something like `index.ts` or `client.tsx`). | ||
```ts | ||
import {createInspector} from 'effector-inspector'; | ||
createInspector(); | ||
``` | ||
4. After that inspector is ready to work, but it does not know about any units yet. You also need to attach inspector to units. | ||
One way to do it is to attach inspector to units manually: | ||
```ts | ||
import {attachInspector} from 'effector-inspector'; | ||
// single units | ||
attachInspector($store); | ||
attachInspector(event); | ||
attachInspector(effectFx); | ||
// or list of them | ||
attachInspector([ | ||
$store, | ||
event, | ||
effectFx, | ||
// any number of units in the list | ||
]); | ||
// or by domain | ||
attachInspector(someDomain); | ||
``` | ||
### effector-root | ||
The `effector-root` library can be used for convenience, as it provides common root domain for all units. | ||
```ts | ||
// index.ts | ||
import {attachInspector, createInspector} from 'effector-inspector'; | ||
import {root} from 'effector-root'; | ||
createInspector(); | ||
attachInspector(root); | ||
``` | ||
Check out `effector-root` [documentation here](https://github.com/effector/root#how-to-auto-replace-all-imports-of-effector-to-effector-root-using-babel-plugin). | ||
## As a part of effector-logger | ||
1. Install effector, logger and **inspector** | ||
@@ -24,4 +89,2 @@ | ||
**effector-inspector** requires `effector` and `effector-logger` to be installed | ||
2. Follow instructions for [effector-logger](https://github.com/sergeysova/effector-logger#installation) | ||
@@ -32,3 +95,3 @@ | ||
3. Open your root application file (`client.tsx` or `index.tsx`) | ||
3. Open your root application file (something like `client.tsx` or `index.tsx`) | ||
@@ -38,3 +101,3 @@ Initialize effector logger in it first lines. | ||
```ts | ||
import { createInspector } from 'effector-inspector'; | ||
import {createInspector} from 'effector-inspector'; | ||
@@ -41,0 +104,0 @@ createInspector(); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
722584
921
116