Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
khaosdoctor committed Jan 18, 2019
1 parent e067136 commit 2a89f00
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class PersonEmailChanged extends Event<IPersonEmailChangeParams> {

The main `Person` entity.

> Since version 2.9.0, EventEntity's constructor receives, as a second parameter the Entity class itself. This is used to update the state internally when adding new events. For now, this second parameter is optional. Not passing it, though, is considered deprecated and will stop being supported on the future
> Since version 2.9.0, EventEntity's constructor receives, as a second parameter, the Entity class itself. This is used to update the state internally when adding new events. For now, this second parameter is optional. **Not passing it, though, is considered deprecated and will stop being supported on the future**
```ts
import ObjectId from 'bson-objectid'
Expand Down Expand Up @@ -275,7 +275,7 @@ Besides `state`, the `EventEntity` class will disclose several other methods suc
- `pushNewEvents`: Will receive an event array following the same `{id, name, data, timestamp}` format, but instead of adding them to the persisted events array, it'll add the events to the `pendingEvents` array and thus, notifying that there are events which were not yet persisted to the database and are only available inside this instance.
- `confirmEvents`: Will move all the items from the `pendingEvents` array to the `persistedEvents` array. This will confirm that all the events were successfuly saved into the database. This will be often used after we save the last state of the entity to the database.

All of the three methods above call the private method `updateState`, which sets all properties from the current state back to the instance of the entity class.
> All of the three methods above call the private method `updateState`, which sets all properties from the current state back to the instance of the entity class. Which means that, when an event changes the value of a property, you don't need to recalculate the state altogether once again, it'll be automatically updated and available through `this.propertyName`
## Repositories

Expand Down Expand Up @@ -371,4 +371,4 @@ If you'd like to add your repository to the list of included repositories, pleas
- Do **not** forget to add the documentation to this repository in the `docs/` folder (the file should be the same name as your class)
- Do **not** forget to add your repository to the list in this README along with the link to its own docs

Thank you for your contribution :D
Thank you for your contribution :D

0 comments on commit 2a89f00

Please sign in to comment.