Skip to content

Commit

Permalink
docs: merge upstream docs changes
Browse files Browse the repository at this point in the history
- merge #2082 (#2082)
  • Loading branch information
cloverich committed Oct 4, 2019
1 parent 5fc4f1f commit 85a33fb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/refguide/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ Returns a disposer function to cancel the side effect.
- **`delay?: number`**: the sideEffect will be delayed and debounced with the given `delay`. Defaults to `0`.
- **`onError?: (error) => void`**: error handler that will be triggered if the autorun function throws an exception
- **`scheduler?: (callback) => void`**: Set a custom scheduler to determine how re-running the autorun function should be scheduled
- **`requiresObservable?: boolean`** Enables [`reactionRequiresObservable`](#reactionrequiresobservable-boolean) locally for the autorun


### `when`
Expand All @@ -373,6 +374,7 @@ If no effect function is passed to `when`, it will return a promise that can be
- **`name?: string`**: A name for easier identification and debugging
- **`onError?: (error) => void`**: error handler that will be triggered if the _predicate-function_ or the _effect-function_ throws an exception
- **`timeout: number`** a timeout in milliseconds, after which the `onError` handler will be triggered to signal the condition not being met within a certain time
- **`requiresObservable?: boolean`** Enables [`reactionRequiresObservable`](#reactionrequiresobservable-boolean) locally for the when

### `reaction`
Usage: `reaction(() => data, data => { sideEffect }, options)`.
Expand All @@ -388,6 +390,7 @@ The side effect can be debounced, just like `autorunAsync`.
- **`delay?: number`**: the sideEffect will be delayed and debounced with the given `delay`. Defaults to `0`.
- **`equals`**: Custom equality function to determine whether the expr function differed from it's previous result, and hence should fire effect. Accepts the same options as the equals option of `computed`.
- Also accepts all of the options from [`autorun`](#autorun)
- **`requiresObservable?: boolean`** Enables [`reactionRequiresObservable`](#reactionrequiresobservable-boolean) locally for the reaction

### `onReactionError`

Expand Down Expand Up @@ -525,6 +528,22 @@ Use this if you want to check whether you are using computed properties without
configure({ computedRequiresReaction: true });
```

#### `observableRequiresReaction: boolean`
Warns about any unobserved observable access.
Use this if you want to check whether you are using observables without a reactive context (eg not inside an autorun, action, or react component without observer wrapping).

```javascript
configure({ observableRequiresReaction: true });
```

#### `reactionRequiresObservable: boolean`
Warns when a reaction (eg `autorun`) is created without any observable access.
Use this to check whether you are unneededly wrapping react components with `observer`, or to find possible related bugs.

```javascript
configure({ reactionRequiresObservable: true });
```

#### `computedConfigurable: boolean`
Allows overwriting computed values. This is useful for testing purposes *only*. Don't enable this
on production as it can cause memory-leaks.
Expand Down

0 comments on commit 85a33fb

Please sign in to comment.