Skip to content

Commit

Permalink
docs: add isInScope function to reactivity adapter page
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnowack committed Oct 4, 2023
1 parent 6f31c76 commit 9ab888c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion docs/reactivity/other/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,23 @@ create: () => {
}
```

### `isInScope(dependency: Dependency): boolean`

The `isInScope` function is used for checking wether a SignalDB is in a reactive context. If SignalDB is not in a reactive context, reactivity will be automatically disabled to avoid memory leaks.

```js
isInScope() {
return !!getScope()
}
```


### `onDispose(callback: () -> void, dependency: Dependency)`

This method is used to register a callback to be executed when the reactive computation is disposed. The dependency created in the [`create`](/reactivity/other/#create-dependency) method, will be passed as the second parameter. This can be useful if a framework requires data from the creation on disposal.

```js
onDispose: (callback, dependency: Dependency) => {
onDispose: (callback, dependency) => {
onDispose(callback)
}
```
Expand Down

0 comments on commit 9ab888c

Please sign in to comment.