Skip to content

Commit

Permalink
stores, stats
Browse files Browse the repository at this point in the history
  • Loading branch information
ampatspell committed Nov 22, 2020
1 parent 7beaad7 commit dac9369
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions docs/api/stores/stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,44 @@ pos: 0

# Stats

List of currently:

* activated models, documents, queries, …
* observed documents, queries, auth, tasks
* pending promises

``` javascript
import { getStores } from 'zuglet/utils';

let stats = getStores(this).stats;
```

``` javascript
let stats = store.stores.stats;
```

## activated

List of activated models, documents, queries, …

Useful for debugging.

## observers

List of documents, queries, auth state change and storage tasks being observed.

Useful for debugging.

## promises

* model
* label
List of currently running promises which are not yet settled. Each promise has `stats` property with `{ model, label }` for debugging.

``` javascript
let promise = stats.promises[0];
promise.stats.model // → <Document…>
promise.stats.label // → 'load'
```

## async settle()

Resolves when all currently running `stats.promises` settle.

0 comments on commit dac9369

Please sign in to comment.