-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
github-actions
committed
Dec 8, 2023
1 parent
c68bee8
commit 0c7bfdc
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@amadeus-it-group/tansu](./tansu.md) > [asWritable](./tansu.aswritable.md) | ||
|
||
## asWritable() function | ||
|
||
Returns a wrapper (for the given store) which only exposes the [WritableSignal](./tansu.writablesignal.md) interface. When the value is changed from the given wrapper, the provided set function is called. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
export declare function asWritable<T, W = T>(store: StoreInput<T>, set?: WritableSignal<T, W>['set']): WritableSignal<T, W>; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| store | [StoreInput](./tansu.storeinput.md)<!-- --><T> | store to wrap | | ||
| set | [WritableSignal](./tansu.writablesignal.md)<!-- --><T, W>\['set'\] | _(Optional)_ function that will be called when the value is changed from the wrapper (through the [set](./tansu.writable.set.md) or the [update](./tansu.writable.update.md) function). If set is not specified, a noop function is used (so the value of the store cannot be changed from the returned wrapper). | | ||
|
||
**Returns:** | ||
|
||
[WritableSignal](./tansu.writablesignal.md)<!-- --><T, W> | ||
|
||
A wrapper which only exposes the [WritableSignal](./tansu.writablesignal.md) interface. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@amadeus-it-group/tansu](./tansu.md) > [asWritable](./tansu.aswritable_1.md) | ||
|
||
## asWritable() function | ||
|
||
Returns a wrapper (for the given store) which only exposes the [WritableSignal](./tansu.writablesignal.md) interface and also adds the given extra properties on the returned object. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
export declare function asWritable<T, U, W = T>(store: StoreInput<T>, extraProps: U & Partial<Pick<WritableSignal<T, W>, 'set' | 'update'>>): WritableSignal<T, W> & Omit<U, keyof WritableSignal<T, W>>; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| store | [StoreInput](./tansu.storeinput.md)<!-- --><T> | store to wrap | | ||
| extraProps | U & Partial<Pick<[WritableSignal](./tansu.writablesignal.md)<!-- --><T, W>, 'set' \| 'update'>> | object containing the extra properties to add on the returned object, and optionally the [set](./tansu.writable.set.md) and the [update](./tansu.writable.update.md) function of the [WritableSignal](./tansu.writablesignal.md) interface. If the set function is not specified, a noop function is used. If the update function is not specified, a default function that calls set is used. | | ||
|
||
**Returns:** | ||
|
||
[WritableSignal](./tansu.writablesignal.md)<!-- --><T, W> & Omit<U, keyof [WritableSignal](./tansu.writablesignal.md)<!-- --><T, W>> | ||
|
||
A wrapper which only exposes the [WritableSignal](./tansu.writablesignal.md) interface and the given extra properties. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@amadeus-it-group/tansu](./tansu.md) > [equal](./tansu.equal.md) | ||
|
||
## equal variable | ||
|
||
Default implementation of the equal function used by tansu when a store changes, to know if listeners need to be notified. Returns false if `a` is a function or an object, or if `a` and `b` are different according to `Object.is`<!-- -->. Otherwise, returns true. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
equal: <T>(a: T, b: T) => boolean | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters