Skip to content

Commit

Permalink
doc: caching and expire time added to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ali77gh committed Apr 1, 2023
1 parent e7f41c9 commit fc8ec55
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

* isCalculating option on dependsOnAsync.


# 1.3.0
# 1.3.1

* bugfix: prevent updating holden when other calculate is running.
* caching.
* caching expire time.
* caching expire time.
* add document to readme.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ And state will get update automatically without calling setState
# Other features:

### Depends on:
Telescopes can be depended on other telescopes
Telescopes can be depended on other telescopes.

```dart
var height = Telescope(186);
Expand All @@ -95,13 +95,27 @@ var showingText = Telescope.dependsOn([bmi], () {
So when ever height or weight value get changes, the bmi will calculate itself because it depends on height and weight.<br>
And showingText will calculate itself too, because it depends on bmi.

<br>

#### Async way:
```dart
var bmi = Telescope.dependsOnAsync(0, [height, weight], () async {
return await calculateBMI(height.value, weight.value);
});
```

<br>

#### Caching:
```dart
var bmi = Telescope.dependsOnAsync(0, [height, weight], () async {
return await calculateBMI(height.value, weight.value);
}, enableCaching: true);
```
You can also set expire time by passing <b>cacheExpireTime</b>.

<br>

#### Observable on loading state:
This will make <b>isCalculatingBMI</b> true on loading and false when loaded, you may need this to show loading animation.
```dart
Expand Down

0 comments on commit fc8ec55

Please sign in to comment.