Skip to content

Commit

Permalink
Small ReadMe update
Browse files Browse the repository at this point in the history
  • Loading branch information
Nickname5862 committed Sep 26, 2024
1 parent 571e046 commit 6216e85
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
7 changes: 0 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

TODO:
Lots of changes!

- Swapped `7 - advanced` with `8 - util` to be able to use advanced techniques in the utils.
- More tests, including `reactor options order of execution (3)`, `fallback-to (5)`, `errors (6)`, `templates, take, map on arrays, mapState, flatMap, pluck (7)`, and `pairwise/scan on normal arrays, peek, lift, final, promise... (8)`.
- The tutorial and solutions are now both available in the same branch. To prevent making every change twice, all changes should now be put in the `generator` folder rather than directly in the `tutorial` or `solution` folder.

## [8.0.0](https://github.com/skunkteam/sherlock/compare/v7.0.0...v8.0.0) (2023-10-17)

### ⚠ BREAKING CHANGES
Expand Down
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,28 +145,39 @@ There are three types of Derivables:
```typescript
const isBrilliant$ = name$.derive(name => name === 'Sherlock');
isBrilliant$.get(); // false
isBrilliant$.get(); // => false
name$.set('Sherlock');
isBrilliant$.get(); // true
isBrilliant$.get(); // => true
```

Derivations can also be created with the generic `derive` function as seen earlier. This function can be used to do an arbitrary calculation on any number of derivables. `@skunkteam/sherlock` automatically records which derivable is dependent on which other derivable to be able to update derived state when needed.

## Reactors

To execute side effects, you can react to changes on any derivable as seen in an earlier example.
To execute side effects, you can react to changes on any derivable as seen in an earlier example. This can be done using the `#react` method that is present on all derivables.

_More documentation coming soon_
```typescript
const normalEffect = atom('');
let sideEffect = '';
## Transactions
normalEffect.react(v => {
sideEffect = v.replace('effect', 'side-effect');
});
_More documentation coming soon_
normalEffect.set('Watch this effect');
sideEffect; // => 'Watch this side-effect'
```

## Interoperability with RxJS out of the box

_Coming soon_
RxJS is another popular reactive library. However, RxJS can become quite complicated and user-unfriendly when your application becomes big. This was the main reason why Sherlock was developed. As Angular uses RxJS, and we use Angualr, our Sherlock library needs to be compatible with RxJS. The `fromObservable()` and `toObservable()` functions are used for this. However, the `from()` function in RxJS has become a succesful alternative to `toObservable()`.
`fromObservable()` can be used to map an `Observable` to a `Derivable`, and the `from()` function in RxJS can be used to map a `Derivable` to a `Derivable`.

## Transactions

_More documentation coming soon_

## Proxies using sherlock-proxies

Expand All @@ -185,5 +196,3 @@ _Coming soon_
### Cyclic reactors

_Coming soon_

TODO: FIX THE README!
2 changes: 1 addition & 1 deletion generator/8 - utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ describe('utils', () => {
});
});

describe('`Promise`, `Observable`, and `EventPattern`', () => {
describe('`Promise`, `Observable`, and `fromEventPattern`', () => {
/**
* Sherlock can also deal with Promises using the `.fromPromise()` and `.toPromise()` functions.
* This translates Promises directly to Sherlock concepts we have discussed already.
Expand Down

0 comments on commit 6216e85

Please sign in to comment.