Skip to content

Commit

Permalink
docs: add domain property for attach
Browse files Browse the repository at this point in the history
Implemented in #895
  • Loading branch information
sergeysova committed Jun 10, 2023
1 parent d5b69f7 commit 766f117
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion beta/src/content/docs/en/api/effector/attach.md
Expand Up @@ -566,12 +566,14 @@ To allow factory works correct, add a path to a `./api/authorized` into `factori
### `name` {#attach-name}

```ts
name?: string
name?: string;
```

It allows us to explicitly set the name of the created attached effect:

```ts
import { attach } from "effector";

const attachedFx = attach({
name: "anotherUsefulName",
source: $store,
Expand All @@ -584,3 +586,28 @@ attachedFx.shortName; // "anotherUsefulName"
```

This parameter exists in **any variant** of the `attach`.

### `domain` {#attach-domain}

```ts
domain?: Domain;
```

> Note: this property can only be used with a plain function `effect`.
It allows to create effect inside specified domain:

```ts
import { createDomain, createStore, attach } from "effector";

const reportErrors = createDomain();
const $counter = createStore(0);

const attachedFx = attach({
domain: reportErrors,
source: $counter,
async effect(counter) {
// ...
},
});
```

0 comments on commit 766f117

Please sign in to comment.