Skip to content

Commit

Permalink
docs(readme): explain the reset method
Browse files Browse the repository at this point in the history
  • Loading branch information
adriancarriger committed Aug 5, 2017
1 parent ae7b607 commit c618e84
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,32 @@ const promise = this.afoDatabase.object('car').update({maxSpeed: 100});
promise.offline.then(() => console.log('offline data saved to device storage!'));
```

### `reset` - delete offline data

The `reset` method is useful for deleting sensitive data when a user signs out of an application. This also helps prevent permission errors when using Firebase auth.

#### Use `reset` with caution

If writes are made while offline `reset` will delete them before they can reach Firebase.

#### `reset` example

```ts
onUserSignout() {
this.afoDatabase.reset()
}
```

#### Calling `reset` on specific references

You can `reset` a specific Firebase reference by passing the reference string to the `reset` method

```ts
onUserSignout() {
this.afoDatabase.reset('my/firebase/ref')
}
```

## How it works

- While online, Firebase data is stored locally (as data changes the local store is updated)
Expand Down

0 comments on commit c618e84

Please sign in to comment.