Skip to content

Commit

Permalink
Fix incorrect links to events
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardograca committed Nov 18, 2018
1 parent e74c785 commit e5f5be0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions lib/base/events.js
Expand Up @@ -81,10 +81,10 @@ class Events extends EventEmitter {
* A promise version of {@link Events#trigger}, returning a promise which
* resolves with all return values from triggered event handlers. If any of the
* event handlers throw an `Error` or return a rejected promise, the promise
* will be rejected. Used internally on the {@link Model#creating "creating"},
* {@link Model#updating "updating"}, {@link Model#saving "saving"}, and {@link
* Model@destroying "destroying"} events, and can be helpful when needing async
* event handlers (for validations, etc).
* will be rejected. Used internally on the {@link Model#event:creating "creating"},
* {@link Model#event:updating "updating"}, {@link Model#event:saving "saving"}, and
* {@link Model@event:destroying "destroying"} events, and can be helpful when needing
* async event handlers (e.g. for validations).
*
* @param {string} name
* The event name, or a whitespace-separated list of event names, to be
Expand Down
20 changes: 10 additions & 10 deletions lib/model.js
Expand Up @@ -941,17 +941,17 @@ const BookshelfModel = ModelBase.extend(
* // ...
* });
*
* Several events fire on the model when saving: a {@link Model#creating
* "creating"}, or {@link Model#updating "updating"} event if the model is
* Several events fire on the model when saving: a {@link Model#event:creating
* "creating"}, or {@link Model#event:updating "updating"} event if the model is
* being inserted or updated, and a "saving" event in either case.
*
* To prevent saving the model (for example, with validation), throwing an error
* inside one of these event listeners will stop saving the model and reject the
* promise.
*
* A {@link Model#created "created"}, or {@link Model#updated "updated"} event is fired
* after the model is saved, as well as a {@link Model#saved "saved"} event
* either way. If you wish to modify the query when the {@link Model#saving
* A {@link Model#event:created "created"}, or {@link Model#event:updated "updated"}
* event is fired after the model is saved, as well as a {@link Model#event:saved "saved"}
* event either way. If you wish to modify the query when the {@link Model#event:saving
* "saving"} event is fired, the knex query object is available in `options.query`.
*
* See the {@tutorial events} guide for further details.
Expand Down Expand Up @@ -1194,12 +1194,12 @@ const BookshelfModel = ModelBase.extend(
* `destroy` performs a `delete` on the model, using the model's {@link
* Model#idAttribute idAttribute} to constrain the query.
*
* A {@link Model#destroying "destroying"} event is triggered on the model before being
* destroyed. To prevent destroying the model (with validation, etc.), throwing an error
* inside one of these event listeners will stop destroying the model and
* reject the promise.
* A {@link Model#event:destroying "destroying"} event is triggered on the model
* before being destroyed. To prevent destroying the model, throwing an error
* inside one of the event listeners will stop destroying the model and reject the
* promise.
*
* A {@link Model#destroyed "destroyed"} event is fired after the model's
* A {@link Model#event:destroyed "destroyed"} event is fired after the model's
* removal is completed.
*
* @method Model#destroy
Expand Down
22 changes: 11 additions & 11 deletions tutorials/events.md
Expand Up @@ -30,12 +30,12 @@ and the listeners will run sequentially.

The available {@link Model model} save related events are:

- {@link Model#saving saving}
- {@link Model#creating creating}
- {@link Model#updating updating}
- {@link Model#created created}
- {@link Model#updated updated}
- {@link Model#saved saved}
- {@link Model#event:saving saving}
- {@link Model#event:creating creating}
- {@link Model#event:updating updating}
- {@link Model#event:created created}
- {@link Model#event:updated updated}
- {@link Model#event:saved saved}

They are fired in this order and it's possible to prevent the request from advancing further by throwing an error or
returning a rejected Promise from any one of these event listeners, e.g.:
Expand Down Expand Up @@ -80,18 +80,18 @@ const User = bookshelf.Model.extend({

The available {@link Model model} data retrieval related events are:

- {@link Model#fetching fetching}
- {@link Model#event:fetching fetching}
- {@link Model#fetching:collection fetching:collection}
- {@link Model#counting counting}
- {@link Model#fetched fetched}
- {@link Model#event:counting counting}
- {@link Model#event:fetched fetched}
- {@link Model#fetched:collection fetched:collection}

### Available destroy related events

The available {@link Model model} destruction related events are:

- {@link Model#destroying destroying}
- {@link Model#destroyed destroyed}
- {@link Model#event:destroying destroying}
- {@link Model#event:destroyed destroyed}

Note that you can get the model's previous attributes after it's destroyed by calling the
{@link Model#previousAttributes previousAttributes} method:
Expand Down

0 comments on commit e5f5be0

Please sign in to comment.