From fad464fb5c2d0cf127ff546857d842b75aeba8d0 Mon Sep 17 00:00:00 2001 From: newhouse Date: Mon, 27 Jul 2020 10:03:58 -0700 Subject: [PATCH] ....and don't clear whitespace --- docs/api.html | 13368 +++++++++++++++++++-------------------- docs/lib_model.js.html | 22 +- 2 files changed, 6695 insertions(+), 6695 deletions(-) diff --git a/docs/api.html b/docs/api.html index 8569ce2f..e20c4135 100644 --- a/docs/api.html +++ b/docs/api.html @@ -39,18 +39,18 @@

See the Events guide for further details.

- + - - + +
- +

- + model source

- - + +
- +
Example
- +
var artist = new bookshelf.Model({
   firstName: "Wassily",
   lastName: "Kandinsky"
@@ -9247,189 +9247,189 @@ 
Example
// {firstName: "Wassily", lastName: "Kandinsky", birthday: "December 16, 1866"}
+ + + + - - - - - +
Parameters
- +
    - +
  • [options] - + Object - +
    - - - + + +
      - +
    • [shallow=false] - + Boolean - +

      Whether to exclude relations from the output or not.

      - +
    • - +
    • [omitPivot=false] - + Boolean - +

      Whether to exclude pivot values from the output or not.

      - +
    • - +
    • [hidden] - + Array - +

      List of model attributes to exclude from the output.

      - +
    • - +
    • [visible] - + Array - +

      List of model attributes to include on the output. All other attributes will be hidden.

      - +
    • - +
    • [visibility=true] - + Boolean - +

      Whether to use visibility options or not. If set to false the hidden and visible options will be ignored.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Return a copy of the model's attributes for JSON stringification. If the model has any relations defined, this @@ -9460,17 +9460,17 @@

Returns

This method is called internally by toJSON. Override this function if you want to customize its output.

- +
- - + +
- +

- + model source

- - + +
- +
Example
- +
customer.set({first_name: "Joe", last_name: "Customer"});
 customer.set("telephone", "555-555-1212");
+ + + + - - - - - +
Parameters
- +
    - +
  • attribute - + stringParameters >Object - +

    Attribute name, or hash of attribute names and values.

    - +
  • - +
  • [value] - + mixed - +

    If a string was provided for attribute, the value to be set.

    - +
  • - +
  • [options] - + Object - +
    - - - + + +
      - +
    • [unset=false] - + Object - +

      Remove attributes from the model instead of setting them.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Set a hash of attributes (one or many) on the model.

- +
- - + +
- +

- + model source

- - + +
- +
Example
- +
const Chapter = bookshelf.model('Chapter', {
   tableName: 'chapters',
   paragraphs() {
@@ -9714,24 +9714,24 @@ 
Example
})
+ + + + - - - - - +
Parameters
- +
    - +
  • Interim - + ModelParameters >string - +

    Pivot model. Can be a string specifying a previously registered model with Bookshelf#model.

    - +
  • - +
  • [throughForeignKey] - + string - +

    Foreign key in this model. By default, the foreign key is assumed to be the singular form of the Target model's tableName, followed by _id or _{{idAttribute}}.

    - +
  • - +
  • [otherKey] - + string - +

    Foreign key in the Interim model. By default, the other key is assumed to be the singular form of this model's tableName, followed by _id / _{{idAttribute}}.

    - +
  • - +
  • [throughForeignKeyTarget] - + string - +

    Column in the Target model which throughForeignKey references, if other than Target model's id / idAttribute.

    - +
  • - +
  • [otherKeyTarget] - + string - +

    Column in this model which otherKey references, if other than id / idAttribute.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Helps to create dynamic relations between models where a hasOne or belongsTo relation may run through another Interim model. This is exactly like the @@ -9905,17 +9905,17 @@

Returns

A good example of where this would be useful is if a paragraph belongsTo a book through a chapter. See the example above on how this can be expressed.

- +
- - + +
- +

- + model source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • [options] - + Object - +
    - - - + + +
      - +
    • [method] - + string - +

      Either 'insert' or 'update' to specify what kind of save the attribute update is for.

      - +
    • - +
    • [date] - + string - +

      Either a Date object or ms since the epoch. Specify what date is used for updateing the timestamps, i.e. if something other than new Date() should be used.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Automatically sets the timestamp attributes on the model, if hasTimestamps is set to true or an array. It @@ -10087,17 +10087,17 @@

Returns
there won't be any automatic updated of these attributes and the user supplied values will be used instead.

- +
- - + +
- +

- + model source

- - + +
+ + + + - - - - - +
Parameters
- + + + +
+ -
+ + + + + + + + + + + + + +
+ + + + + + +
+ +
+

Called automatically by JSON.stringify. To customize serialization, override serialize.

+
+ +
+ + +
+ +

+ + + model.trigger() + source +

+ + +
+ +
+
Example
+ +
ship.trigger('fetched');
+
+ + - - - - - - - - - - - - - - -
- - -
-

Called automatically by JSON.stringify. To customize serialization, override serialize.

-
- -
- - - -
- - -

- - - model.trigger() - source -

- - - - -
- - -
-
Example
- -
ship.trigger('fetched');
- -
- - - - - - - - - - - - - -
- - - - - - - - + + + + +
+ + + + + + + + + + + + +
See
+ - - +
+ + + + + - - - - - - +
- +
- - + +
- +

- + model source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • name - + string - +

    The event name or a whitespace-separated list of event names to be triggered.

    - +
  • - +
  • [args] - + mixed - +

    Arguments to be passed to any registered event handlers.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

A promise version of Events#trigger, returning a promise which resolves with all return values from triggered event handlers. If any of the @@ -10446,17 +10446,17 @@

Returns
"destroying" events, and can be helpful when needing async event handlers (e.g. for validations).

- +
- - + +
- +

- + model source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • attribute - +

    Attribute to unset.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Remove an attribute from the model. unset is a noop if the attribute doesn't exist.

@@ -10574,17 +10574,17 @@
Returns
column in the database record, set the attribute value to null instead: model.set("column_name", null).

- +
- - + +
- +

- + model source

- - + +
- +
Example
- +
model.where('favorite_color', '<>', 'green').fetch().then(function() { //...
 // or
 model.where('favorite_color', 'red').fetch().then(function() { //...
@@ -10608,24 +10608,24 @@ 
Example
model.where({favorite_color: 'red', shoe_size: 12}).fetch().then(function() { //...
+ + + + - - - - - +
Parameters
- +
    - +
  • method - + ObjectParameters >string - +

    Either key, [operator], value syntax, or a hash of attributes to match. Note that these must be formatted as they are in the database, not how they are stored after Model#parse.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + - - - - - - - - - - - - - +
See
+ - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

The where method is used as convenience for the most common query method, adding a where clause to the builder. Any additional knex methods may be accessed using query.

Accepts either key, value syntax, or a hash of attributes.

- +
- + + - - +

Lodash Methods

+ + - - - +

Events

- - + +
- +

- - + + model source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • model - + Model - +

    The model firing the event.

    - +
  • - +
  • options - + Object - +

    Options object passed to count.

    - +
  • - +
+ - - +
+ + + + + + + + + + + - - - - - - - - - - - - +
Tutorials
+ + - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Counting event.

Fired before a count query. A promise may be returned from the event handler for async behaviour.

- +
- - + +
- +

- - + + model source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • model - + Model - +

    The model firing the event with its attributes matching what's in the database.

    - +
  • - +
  • options - + Object - +

    Options object passed to save.

    - +
  • - +
+ - - +
+ + + + + + + + + + + - - - - - - - - - - - - +
Tutorials
+ + - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Created event.

Fired after an insert query.

- +
- - + +
- +

- - + + model source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • model - + Model - +

    The model firing the event.

    - +
  • - +
  • attrs - + Object - +

    Attributes that will be inserted.

    - +
  • - +
  • options - + Object - +

    Options object passed to save.

    - - + +
      - +
    • query - + QueryBuilder - +

      Query builder to be used for saving. This can be used to modify or add to the query before it is executed.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + - - - - - - - - - - - - +
Tutorials
+ + - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Creating event.

Fired before an insert query. A Promise may be returned from the event handler for async behaviour. Throwing an exception from the handler will cancel the save process.

- +
- - + +
- +

- - + + model source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • model - + Model - +

    The model firing the event.

    - +
  • - +
  • options - + Object - +

    Options object passed to destroy.

    - +
  • - +
+ - - +
+ + + + + + + + + + + - - - - - - - - - - - - +
Tutorials
+ + - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Destroyed event.

Fired after a delete query. A promise may be returned from the event handler for async behaviour.

- +
- - + +
- +

- - + + model source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • model - + Model - +

    The model firing the event.

    - +
  • - +
  • options - + Object - +

    Options object passed to destroy.

    - +
  • - +
+ - - +
+ + + + + + + + + + + - - - - - - - - - - - - +
Tutorials
+ + - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Destroying event.

Fired before a delete query. A promise may be returned from the event handler for async behaviour. Throwing an exception from the handler will reject the promise and cancel the deletion.

- +
- - + +
- +

- - + + model source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • model - + Model - +

    The model firing the event.

    - +
  • - +
  • response - + Object - +

    Knex query response.

    - +
  • - +
  • options - + Object - +

    Options object passed to fetch.

    - +
  • - +
+ - - +
+ + + + + + + + + + + - - - - - - - - - - - - +
Tutorials
+ + - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Fired after a fetch operation. A promise may be returned from the event handler for async behaviour.

- +
- - + +
- +

- - + + model source

- - + +
- +
Example
- +
const MyModel = bookshelf.model('MyModel', {
   initialize() {
     this.on('fetching', function(model, columns, options) {
@@ -11773,160 +11773,160 @@ 
Example
})
+ + + + - - - - - +
Parameters
- +
    - +
  • model - + Model - +

    The model which is about to be fetched.

    - +
  • - +
  • columns - + string[] - +

    The columns to be retrieved by the query.

    - +
  • - +
  • options - + Object - +

    Options object passed to fetch.

    - - + +
      - +
    • query - + QueryBuilder - +

      Query builder to be used for fetching. This can be used to modify or add to the query before it is executed. See example above.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + - - - - - - - - - - - - +
Tutorials
+ + - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Fired before a fetch operation. A promise may be returned from the event handler for async behaviour.

- +
- - + +
- +

- - + + model source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • model - + Model - +

    The model firing the event with its attributes matching what's in the database.

    - +
  • - +
  • options - + Object - +

    Options object passed to save.

    - +
  • + +
- - - - - - - -
- - - - - - - - - + + +
+ + + + + + + + + + + +
Tutorials
+ + - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Saved event.

Fired after an insert or update query.

- +
- - + +
- +

- - + + model source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • model - + Model - +

    The model firing the event. Its attributes are already changed but not commited to the database yet.

    - +
  • - +
  • attrs - + Object - +

    Attributes that will be inserted or updated.

    - +
  • - +
  • options - + Object - +

    Options object passed to save.

    - - + +
      - +
    • query - + QueryBuilder - +

      Query builder to be used for saving. This can be used to modify or add to the query before it is executed.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + - - - - - - - - - - - - +
Tutorials
+ + - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Saving event.

Fired before an insert or update query. A Promise may be returned from the event handler for async behaviour. Throwing an exception from the handler will cancel the save process.

- +
- - + +
- +

- - + + model source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • model - + Model - +

    The model firing the event with its attributes matching what's in the database.

    - +
  • - +
  • options - + Object - +

    Options object passed to save.

    - +
  • - +
+ - - +
+ + + + + + + + + + + - - - - - - - - - - - - +
Tutorials
+ + - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Updated event.

Fired after an update query.

- +
- - + +
- +

- - + + model source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • model - + Model - +

    The model firing the event. Its attributes are already changed but not commited to the database yet.

    - +
  • - +
  • attrs - + Object - +

    Attributes that will be updated.

    - +
  • - +
  • options - + Object - +

    Options object passed to save.

    - - + +
      - +
    • query - + QueryBuilder - +

      Query builder to be used for saving. This can be used to modify or add to the query before it is executed.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + - - - - - - - - - - - - +
Tutorials
+ + - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Updating event.

Fired before an update query. A Promise may be returned from the event handler for async behaviour. Throwing an exception from the handler will cancel the save process.

- +
- - + +
- +

- - + + model source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • collection - + Collection - +

    The collection that has been fetched.

    - +
  • - +
  • response - + Object - +

    The raw response from the underlying query builder. This will be an array with objects representing each row, similar to the output of a serialized Model.

    - +
  • - +
  • options - + Object - +

    Options object passed to fetchAll.

    - +
  • - +
+ - - +
+ + + + + + + + + + + - - - - - - - - - - - - +
Tutorials
+ + - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Fired after a fetchAll operation. A promise may be returned from the event handler for async behaviour.

- +
- - + +
- +

- - + + model.on("fetching:collection", (collection, columns, options) => source -

- - - - -
- - - + + + +
+ + + + +
Parameters
- +
    - +
  • collection - + Collection - +

    The collection that is going to be fetched. At this point it's still empty since the fetch hasn't happened yet.

    - +
  • - +
  • columns - + string[] - +

    The columns to be retrieved by the query as provided by the underlying query builder. If the columns option is not specified the value of this will usually be an array with a single string 'tableName.*'.

    - +
  • - +
  • options - + Object - +

    Options object passed to fetchAll.

    - +
  • - +
+ - - +
+ + + + + + + + + + + - - - - - - - - - - - - +
Tutorials
+ + - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Fired before a fetchAll operation. A promise may be returned from the event handler for async behaviour.

- +
- - + + - +
- +

Model.NoRowsDeletedError

- - + +
- +

Construction

- +
- +

- + new - + Model source

- - + +
+ + + + + - - - - - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

Thrown when no record is deleted by destroy unless called with the {require: false} option.

- +
+ - - +
+ + + + + + + + + - - - - - - - - - - +
@@ -13137,28 +13137,28 @@

- +

Model.NoRowsUpdatedError

- - + +
- +

Construction

- +
- +

- + new - + Model source

- - + +
+ + + + + - - - - - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

Thrown when no records are saved by save unless called with the {require: false} option.

- +
+ - - +
+ + + + + + + + + - - - - - - - - - - +
@@ -13274,28 +13274,28 @@

- +

Model.NotFoundError

- - + +
- +

Construction

- +
- +

- + new - + Model source

- - + +
+ + + + + - - - - - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

Thrown when no records are found by fetch or refresh unless called with the {require: false} option.

- +
+ - - +
+ + + + + + + + + - - - - - - - - - - +
@@ -13418,176 +13418,176 @@

- +

Collection

- +

Collections are ordered sets of models returned from the database, from a fetchAll call.

- - + +
- +

Construction

- +
- +

- + new - + Collection([models], [options]) source

- - + +
- +
Example
- +
const TabSet = bookshelf.collection('TabSet', {
   model: Tab
 })
 const tabs = new TabSet([tab1, tab2, tab3])
+ + + + - - - - - +
Parameters
- +
    - +
  • [models] - + Model[] - +

    Initial array of models.

    - +
  • - +
  • [options] - + Object - +
    - - - + + +
      - +
    • [comparator=false] - + Boolean - +

      Comparator for collection, or false to disable sorting.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

When creating a Collection, you may choose to pass in the initial array of models. The collection's comparator may be included @@ -13618,17 +13618,17 @@

Parameters
} })
- +
- - + +
- +

- + collection source

- - + +
+ + + + + - - - - - - +
+ + + + + + + + + + + + - - - - - - - - - - - - - +
See
+ - - +
+ + + + + - - - - - - +
- +

Called by the Collection constructor when creating a new instance. Override this function to add custom initialization, such as event listeners. @@ -13717,33 +13717,33 @@

// Your initialization code ... }

- +
+ - - +
+ + + + - - - - - +

Static

- - + +
- +

- + Collection source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • [prototypeProperties] - + Object - +

    Instance methods and properties to be attached to instances of the new class.

    - +
  • - +
  • [classProperties] - + Object - +

    Class (ie. static) functions and properties to be attached to the constructor of the new class.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns

- +
- +

To create a Collection class of your own, extend Bookshelf.Collection.

- + - - + +
- +

- + Collection source

- - + +
- +
Example
- +
var Promise = require('bluebird');
 var Accounts = bookshelf.Collection.extend({
   model: Account
@@ -13925,24 +13925,24 @@ 
Example
});
+ + + + - - - - - +
Parameters
- +
    - +
  • [models] - + Object[]Parameters >Model[] - +

    Set of models (or attribute hashes) with which to initialize the collection.

    - +
  • - +
  • options - + Object - +

    Hash of options.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

A simple helper function to instantiate a new Collection without needing new.

- +
- + + - - +

Members

- - + +
- +

- + collection source

- - + +
- +
Example
- +
// select count(*) from shareholders where company_id = 1 and share &gt; 0.1;
 new Company({id: 1})
   .shareholders()
@@ -14081,119 +14081,119 @@ 
Example
})
+ + + + - - - - - +
Parameters
- +
    - +
  • [column='*'] - + string - +

    Specify a column to count. Rows with null values in this column will be excluded.

    - +
  • - +
  • [options] - + Object - +

    Hash of options.

    - +
  • - +
+ - - +
+ - - +
Since
  • 0.8.2
+ + + + + + + + + + + - - - - - - - - - - - - +
See
+ - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Get the number of records in the collection's table.

- +
- - + +
- +

- + collection source

- - + +
- +
Example
- +
const { courses, ...attributes } = req.body;
 
 Student.forge(attributes).save().tap(student =>
@@ -14249,153 +14249,153 @@ 
Example
);
+ + + + - - - - - +
Parameters
- +
    - +
  • model - + Object - +

    A set of attributes to be set on the new model.

    - +
  • - +
  • [options] - + Object - +
    - - - + + +
      - +
    • [transacting] - + Transaction - +
      - - + +
    • - +
    • [debug=false] - + boolean - +

      Whether to enable debugging mode or not. When enabled will show information about the queries being run.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Convenience method to create a new model instance within a collection. Equivalent to instantiating a model with a hash of attributes, saving the model to the @@ -14421,17 +14421,17 @@

Returns

When used on a relation, create will automatically set foreign key attributes before persisting the Model.

- +
- - + +
- +

- + collection source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • [options] - + Object - +
    - - - + + +
      - +
    • [require=false] - + Boolean - +

      Whether or not to throw a Collection.EmptyError if no records are found. You can pass the require: true option to override this behavior.

      - +
    • - +
    • [withRelated=[]] - + stringParameters >string[] - +

      A relation, or list of relations, to be eager loaded as part of the fetch operation.

      - +
    • - +
    • [debug=false] - + boolean - +

      Whether to enable debugging mode or not. When enabled will show information about the queries being run.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ - - +
Fires
+ + + - - - - +
Throws
- - + + Collection.EmptyErrorThrows
+ - - +
Returns
- - + + Returns - +
- +

Fetch the default set of models for this collection from the database, resetting the collection when they arrive. If you wish to trigger an @@ -14650,17 +14650,17 @@

Returns
queries will be loaded into a relations property on the respective models, may be retrieved with the related method.

- + - - + +
- +

- + collection source

- - + +
- +
Example
- +
// select * from authors where site_id = 1 and id = 2 limit 1;
 new Site({id:1})
   .authors()
@@ -14687,61 +14687,61 @@ 
Example
});
+ + + + - - - - - +
Parameters
- +
    - +
  • [options] - + Object - +
    - - - + + +
      - +
    • [require=true] - + Boolean - +

      Whether or not to reject the returned Promise with a Model.NotFoundError if no records can be fetched from the database.

      - +
    • - +
    • [columns='*'] - + stringParameters >string[] - +

      Limit the number of columns fetched.

      - +
    • - +
    • [transacting] - + Transaction - +

      Optionally run the query in a transaction.

      - +
    • - +
    • [lock] - + string - +

      Type of row-level lock to use. Valid options are forShare and forUpdate. This only works in conjunction with the transacting option, and requires a database that supports it.

      - +
    • - +
    • [debug=false] - + boolean - +

      Whether to enable debugging mode or not. When enabled will show information about the queries being run.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + - - - - - +
Throws
- - + + Model.NotFoundErrorThrows
+ - - +
Returns
- - + + Returns - +
- +

Fetch and return a single model from the collection, maintaining any relation data from the collection, and @@ -14916,17 +14916,17 @@

Returns
to the collection. Especially helpful on relations, where you would only like to return a single model from the associated collection.

- + - - + +
- +

- + collection source

- - + +
- +
Example
- +
var vanHalen = new bookshelf.Collection([eddie, alex, stone, roth]);
 console.log(vanHalen.length) // 4
+ + + + + - - - - - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

This is the total number of models in the collection. Note that this may not represent how many models there are in total in the database.

- +
- - + +
- +

- + collection source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • relations - + stringParameters >string[] - +

    The relation, or relations, to be loaded.

    - +
  • - +
  • [options] - + Object - +

    Hash of options.

    - - + +
      - +
    • [transacting] - + Transaction - +
      - - + +
    • - +
    • [lock] - + string - +

      Type of row-level lock to use. Valid options are forShare and forUpdate. This only works in conjunction with the transacting option, and requires a database that supports it.

      - +
    • - +
    • [debug=false] - + boolean - +

      Whether to enable debugging mode or not. When enabled will show information about the queries being run.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

This method is used to eager load relations onto a Collection, in a similar way that the withRelated property works on fetch. Nested eager loads can be specified by separating the nested relations with ..

- +
+ + - - - +

Methods

- - + +
- +

- + collection source

- - + +
- +
Example
- +
const ships = new bookshelf.Collection;
 
 ships.add([
@@ -15268,25 +15268,25 @@ 
Example
{name: "Black Pearl"} ]);
-
- - - - - +
+ + + + +
Parameters
- +
    - +
  • models - + Object[]Parameters >Model - +

    One or more models or raw attribute objects.

    - +
  • - +
  • [options] - + Object - +

    Options for controlling how models are added.

    - - + +
      - +
    • [merge=false] - + Boolean - +

      If set to true it will merge the attributes of duplicate models with the attributes of existing models in the collection.

      - +
    • - +
    • [at] - + Number - +

      If set to a number equal to or greater than 0 it will splice the model into the collection at the specified index number.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Add a model, or an array of models, to the collection. You may also pass raw attribute objects, which will be converted to proper models @@ -15452,17 +15452,17 @@

Returns
which case their attributes will be merged with the corresponding models.

- +
- - + +
- +

- + collection source

- - + +
+ + + + + - - - - - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

Get a model from a collection, specified by index. Useful if your collection is sorted, and if your collection isn't sorted, at will still retrieve models in insertion order.

- +
- - + +
- +

- + collection source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • ids - + mixedParameters >mixed[] - +

    One or more ID values or models to be attached to the relation.

    - +
  • - +
  • options - + Object - +

    A hash of options.

    - - + +
      - +
    • transacting - + Transaction - +

      Optionally run the query in a transaction.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Attaches one or more ids or models from a foreign table to the current table, on a many-to-many relation. Creates and saves a new @@ -15728,17 +15728,17 @@

Returns

This method (along with Collection#detach and Collection#updatePivot) are mixed in to a Collection when returned by a belongsToMany relation.

- +
- - + +
- +

- + collection source

- - + +
+ + + + + - - - - - - +
+ + + - - - - +
Overrides
+ + + + + + + + + + - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

Create a new collection with an identical list of models as this one.

- +
- - + +
- +

- + collection source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • [ids] - + mixedParameters >mixed[] - +

    One or more ID values or models to be detached from the relation.

    - +
  • - +
  • options - + Object - +

    A hash of options.

    - - + +
      - +
    • transacting - + Transaction - +

      Optionally run the query in a transaction.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Detach one or more related objects from their pivot tables. If a model or id is passed, it attempts to remove from the pivot table based on that @@ -15997,17 +15997,17 @@

Returns

This method (along with Collection#attach and Collection#updatePivot) are mixed in to a Collection when returned by a belongsToMany relation.

- +
- - + +
- +

- + collection source

+ + +
+ -
- - - - - - - - - - - - - - -
- - - - - - - - + + + + + +
+ + + + + + + + + + + + + +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Returns the first model in the collection or undefined if the collection is empty.

- +
- - + +
- +

- + collection source

- - + +
- +
Example
- +
const book = library.get(110);
+ + + + + - - - - - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Get a model from a collection, specified by an id, a cid, or by passing in a model.

- +
- - + +
- +

- + collection source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • method - + string - +

    The model method to invoke.

    - +
  • - +
  • arguments - + mixed - +

    Arguments to method.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Shortcut for calling Promise.all around a Collection#invoke, this will delegate to the collection's invoke method, resolving the promise with @@ -16369,17 +16369,17 @@

Returns
// ... all models in the collection have been destroyed });
- +
- - + +
- +

- + collection source

- - + +
+ + + + + - - - - - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Returns the last model in the collection or undefined if the collection is empty.

- +
- - + +
- +

- + collection source

- - + +
- +
Example
- +
ships.off('fetched') // Remove the 'fetched' event listener
+ + + + + - - - - - - +
+ + + + + + + + + + + + - - - - - - - - - - - - - +
See
+ - - +
+ + + + + - - - - - - +
- +
- - + +
- +

- + collection source

- - + +
- +
Example
- +
const ships = new bookshelf.Collection
 ships.on('fetched', function(collection) {
   // Do something after the data has been fetched from the database
 })
+ + + + + - - - - - - +
+ + + + + + + + + + + + - - - - - - - - - - - - - +
See
+ - - +
+ + + + + - - - - - - +
- +

Registers an event listener.

- +
- - + +
- +

- + collection source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • nameOrNames - + string - +

    The name of the event or space separated list of events to register a callback for.

    - +
  • - +
  • callback - + function - +

    That callback to invoke only once when the event is fired.

    - +
    -
  • - -
- - - - - - -
- - - - - - - - - - - - - - - - + + + + + +
+ + + + + + + -
+ + + + + + + +
+ + + + + +
- +

Just like Events#on, but causes the bound callback to fire only once before being removed. Handy for saying "the next time that X happens, @@ -16805,17 +16805,17 @@

Parameters
syntax, the event will fire once for every event you passed in, not once for a combination of all events.

- +
- - + +
- +

- + collection source

- - + +
- +
Example
- +
Cars.forge().orderBy('color', 'ASC').fetch()
    .then(function (rows) { // ...
+ + + + - - - - - +
Parameters
- +
    - +
  • column - + string - +

    Column to sort on.

    - +
  • - +
  • order - + string - +

    Ascending ('ASC') or descending ('DESC') order.

    - +
  • - +
+ - - +
+ - - +
Since
  • 0.9.3
+ + + + + + + + + + + + - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

Specifies the column to sort on and sort order.

The order parameter is optional, and defaults to 'ASC'. You may @@ -16950,17 +16950,17 @@

Parameters

Unless specified using dot notation (i.e., "table.column"), the default table will be the table name of the model orderBy was called on.

- +
- - + +
- +

- + collection source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • resp - + Object[] - +

    Raw database response array.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

The parse method is called whenever a collection's data is returned in a fetch call. The function is passed the raw @@ -17065,17 +17065,17 @@

Parameters
collection. The default implementation is a no-op, simply passing through the JSON response.

- +
- - + +
- +

- + collection source

- - + +
+ + + + + - - - - - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Pluck an attribute from each model in the collection.

- +
- - + +
- +

- + collection source

- - + +
+ + + + + - - - - - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

Remove a model from the end of the collection.

- +
- - + +
- +

- + collection source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • model - + Object[]Parameters >Model - +

    One or more models or raw attribute objects.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Add a model to the end of the collection.

- +
- - + +
- +

- + collection source

- - + +
- +
Example
- +
let qb = collection.query();
     qb.where({id: 1}).select().then(function(resp) {
       // ...
@@ -17436,102 +17436,102 @@ 
Example
});
+ + + + - - - - - +
Parameters
- +
    - +
  • arguments - + function|Object|string - - - -
    -

    The query method.

    - -
    - -
  • - -
- - - - - - -
- - - - - - - + >Object|string + + +
+

The query method.

+ +
+ + + + + +
+ + + + + + + + + + + + +
See
+ - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

This method is used to tap into the underlying Knex query builder instance for the current collection.

@@ -17561,17 +17561,17 @@
Returns

If the method argument is a function, it will be called with the Knex query builder as the context and the first argument.

- +
- - + +
- +

- + collection source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • iterator - + Collection~reduceThenIterator - +
    - - + +
  • - +
  • initialValue - + mixed - +
    - - + +
  • - +
  • context - + Object - +

    Bound to this in the iterator callback.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + - - - - - - - - - - - - - +
See
+ - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Iterate over all the models in the collection and reduce this array to a single value using the given iterator function.

- +
- - + +
- +

- + collection source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • models - + ModelParameters >Model[] - +

    The model, or models, to be removed.

    - +
  • - +
  • [options] - + Object - +

    Set of options for the operation.

    - - + +
      - +
    • [silent] - + Boolean - +

      If set to true will not trigger a remove event on the removed model.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Remove a model, or an array of models, from the collection. Note that this does not remove the affected models from the database. For that purpose you have to use the model's destroy method.

@@ -17915,17 +17915,17 @@
Returns
// models have been destroyed })
- +
- - + +
- +

- + collection source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • models - + Object[]Parameters >Model - +

    One or more models or raw attribute objects.

    - +
  • - +
  • options - + Object - +

    See add.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Adding and removing models one at a time is all well and good, but sometimes you have so many models to change that you'd rather just update the @@ -18073,17 +18073,17 @@

Returns
models (or attribute hashes). Calling collection.reset() without passing any models as arguments will empty the entire collection.

- +
- - + +
- +

- + collection source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • [options] - + Object - +
    - - - + + +
      - +
    • [shallow=false] - + Boolean - +

      Exclude relations.

      - +
    • - +
    • [omitPivot=false] - + Boolean - +

      Exclude pivot values.

      - +
    • - +
    • [omitNew=false] - + Boolean - +

      Exclude models that return true for isNew.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Return a raw array of the collection's attributes for JSON stringification. If the models have any relations defined, this will also call toJSON on @@ -18268,17 +18268,17 @@

Returns

serialize is called internally by toJSON. Override this function if you want to customize its output.

- +
- - + +
- +

- + collection source

- - + +
- +
Example
- +
var vanHalen = new bookshelf.Collection([eddie, alex, stone, roth]);
 vanHalen.set([eddie, alex, stone, hagar]);
+ + + + - - - - - +
Parameters
- +
    - +
  • models - + Object[]Parameters >Model - +

    One or more models or raw attribute objects.

    - +
  • - +
  • [options] - + Object - +

    Options for controlling how models are added or removed.

    - - + +
      - +
    • [add=true] - + Boolean - +

      If set to true it will add any new models to the collection, otherwise any new models will be ignored.

      - +
    • - +
    • [merge=true] - + Boolean - +

      If set to true it will merge the attributes of duplicate models with the attributes of existing models in the collection, otherwise duplicate models in the list will be ignored.

      - +
    • - +
    • [remove=true] - + Boolean - +

      If set to true any models in the collection that are not in the list will be removed from the collection, otherwise they will be kept.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

The set method performs a smart update of the collection with the passed model or list of models by following the following rules:

@@ -18508,17 +18508,17 @@
Returns
otherwise they will either be removed or merged, according to the chosen option.

- +
- - + +
- +

- + collection source

- - + +
+ + + + + - - - - - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

Remove a model from the beginning of the collection.

- +
- - + +
- +

- + collection source

- - + +
+ + + + + - - - - - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

Slice out a sub-array of models from the collection.

- +
- - + +
- +

- + collection source

- - + +
- +
Example
- +
const Chapter = bookshelf.model('Chapter', {
   tableName: 'chapters',
   paragraphs() {
@@ -18729,170 +18729,170 @@ 
Example
})
+ + + + - - - - - +
Parameters
- +
    - +
  • Interim - + Model - +

    Pivot model.

    - +
  • - +
  • [throughForeignKey] - + string - +

    Foreign key in this collection's model. This is the model that the hasMany or belongsToMany relations return. By default, the foreignKey is assumed to be the singular form of the Target model's tableName, followed by _id / _{{idAttribute}}.

    - +
  • - +
  • [otherKey] - + string - +

    Foreign key in the Interim model. By default, the otherKey is assumed to be the singular form of this model's tableName, followed by _id / _{{idAttribute}}.

    - +
  • - +
  • [throughForeignKeyTarget] - + string - +

    Column in this collection's model which throughForeignKey references, if other than the default of the model's id / idAttribute.

    - +
  • - +
  • [otherKeyTarget] - + string - +

    Column in the Interim model which otherKey references, if other than id / idAttribute.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Used to define relationships where a hasMany or belongsToMany relation passes "through" an Interim model. This @@ -18920,17 +18920,17 @@

Returns

A good example of where this would be useful is if a book hasMany paragraphs through chapters. See the example above for how this can be used.

- +
- - + +
- +

- + collection source

- - + +
+ + + + - - - - - +
Parameters
- + + - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

Called automatically by JSON.stringify. To customize serialization, override serialize.

- +
- - + +
- +

- + collection.trigger() source -

- - - - -
- - -
-
Example
- -
ships.trigger('fetched')
- -
- - - - - - - - - - - - - -
- - + + + +
+ +
+
Example
+ +
ships.trigger('fetched')
+
+ + + + + + +
+ + + + + + + + + + + + +
See
+ - - +
+ + + + + - - - - - - +
- +
- - + +
- +

- + collection source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • name - + string - +

    The event name or a whitespace-separated list of event names to be triggered.

    - +
  • - +
  • [args] - + mixed - +

    Arguments to be passed to any registered event handlers.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

A promise version of Events#trigger, returning a promise which resolves with all return values from triggered event handlers. If any of the @@ -19279,17 +19279,17 @@

Returns
"destroying" events, and can be helpful when needing async event handlers (e.g. for validations).

- +
- - + +
- +

- + collection source

- - + +
+ + + + + - - - - - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

Add a model to the beginning of the collection.

- +
- - + +
- +

- + collection source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • attributes - + Object - +

    Values to be set in the update query.

    - +
  • - +
  • [options] - + Object - +

    A hash of options.

    - - + +
      - +
    • [query] - + functionParameters >Object - +

      Constrain the update query. Similar to the method argument to Model#query.

      - +
    • - +
    • [require=false] - + Boolean - +

      Causes promise to be rejected with an Error if no rows were updated.

      - +
    • - +
    • [transacting] - + Transaction - +

      Optionally run the query in a transaction.

      - +
    • - +
    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

The updatePivot method is used exclusively on belongsToMany relations, and allows for updating pivot rows on the joining table.

This method (along with Collection#attach and Collection#detach) are mixed in to a Collection when returned by a belongsToMany relation.

- +
- - + +
- +

- + collection source

- - + +
- +
Example
- +
collection
   .where('favorite_color', '<>', 'green')
   .fetch()
@@ -19628,24 +19628,24 @@ 
Example
})
+ + + + - - - - - +
Parameters
- +
    - +
  • conditions - + ObjectParameters >string - +

    Either key, [operator], value syntax, or a hash of attributes to match. Note that these must be formatted as they are in the database, not how they are stored after Model#parse.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + - - - - - - - - - - - - - +
See
+ - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

This is used as convenience for the most common query method: adding a WHERE clause to the builder. Any additional knex methods may be accessed using query.

Accepts either key, value syntax, or a hash of attributes to constrain the results.

- +
- - + +
- +

- + collection source

+ + +
+ -
- - - - - - - - - - -
Parameters
- - -
    - -
  • - columns - - - string[] - - - -
    -

    Names of columns to be included when retrieving pivot table rows.

    - -
    - -
  • - -
- - - - - - -
- - - + + + + +
Parameters
+ +
    + +
  • + columns + + string[] + + +
    +

    Names of columns to be included when retrieving pivot table rows.

    + +
    +
  • + +
+ + +
+ + + + + + + + + + + + + +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

The withPivot method is used exclusively on belongsToMany relations, and allows for additional fields to be pulled from the joining table.

@@ -19883,285 +19883,285 @@
Returns
} });
- +
- +
+ - - +

Lodash Methods

+ - - +

Type Definitions

- - + +
- +

- + reduceThenIterator(acumulator, model, index, length) source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • acumulator - + mixed - +
    - - + +
  • - +
  • model - + Model - +

    The current model being iterated over.

    - +
  • - +
  • index - + Number - +
    - - + +
  • - +
  • length - + Number - +

    Total number of models being iterated over.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

This iterator is used by the reduceThen method to ietrate over all models in the collection.

- +
+ + - - - +

Events

- - + +
- +

- - + + collection source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • collection - + Collection - +

    The collection performing the Collection#fetch.

    - +
  • - +
  • response - + Object - +

    Knex query response.

    - +
  • - +
  • options - + Object - +

    Options object passed to fetch.

    - +
  • - +
+ - - +
+ + + + + + + + + + + - - - - - - - - - - - - +
Tutorials
+ + - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Fired after a fetch operation. A promise may be returned from the event handler for async behaviour.

- +
- - + + - +
- +

Collection.EmptyError

- - + +
- +

Construction

- +
- +

- + new - + Collection source

- - + +
+ + + + + - - - - - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

Thrown by default when no records are found by fetch or Collection#fetchOne. This behavior can be overrided with the Model#requireFetch option.

- +
+ - - +
+ + + + + + + + + - - - - - - - - - - +
@@ -20479,132 +20479,132 @@

- - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - + + +
+ + + + + + +
+ + + + + + + -
+ + + + + + + +
+ + + + + +
- +

Base Event class inherited by Model and Collection. It's not meant to be used directly, and is only displayed here for completeness.

- +
+ - - +
+ + + + + + - - - - - - - +

Methods

- - + +
- +

- + events source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • nameOrNames - + string - +

    The name of the event or space separated list of events to stop listening to.

    - +
  • - +
  • callback - + function - +

    That callback to remove.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

Remove a previously-bound callback event listener from an object. If no event name is specified, callbacks for all events will be removed.

- +
- - + +
- +

- + events source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • nameOrNames - + string - +

    The name or space separated names of events to register a callback for.

    - +
  • - +
  • callback - + function - +

    That callback to invoke whenever the event is fired.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

Registers an event listener. The callback will be invoked whenever the event is fired. The event string may also be a space-delimited list of several event names.

- +
- - + +
- +

- + events source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • nameOrNames - + string - +

    The name of the event or space separated list of events to register a callback for.

    - +
  • - +
  • callback - + function - +

    That callback to invoke only once when the event is fired.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

Just like Events#on, but causes the bound callback to fire only once before being removed. Handy for saying "the next time that X happens, @@ -21007,17 +21007,17 @@

Parameters
syntax, the event will fire once for every event you passed in, not once for a combination of all events.

- +
- - + +
- +

- + events source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • nameOrNames - + string - +

    The name of the event to trigger. Also accepts a space separated list of event names.

    - +
  • - +
  • [args] - + mixed - +

    Extra arguments to pass to the event listener callback function.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
- +

Trigger callbacks for the given event, or space-delimited list of events. Subsequent arguments to trigger will be passed along to the event callback.

- +
- - + +
- +

- + events source

- - + +
+ + + + - - - - - +
Parameters
- +
    - +
  • name - + string - +

    The event name or a whitespace-separated list of event names to be triggered.

    - +
  • - +
  • [args] - + mixed - +

    Arguments to be passed to any registered event handlers.

    - +
  • - +
+ - - +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - +
+ + + + + - - - - - - +
Returns
- - + + Returns - +
- +

A promise version of Events#trigger, returning a promise which resolves with all return values from triggered event handlers. If any of the @@ -21292,18 +21292,18 @@

Returns
"destroying" events, and can be helpful when needing async event handlers (e.g. for validations).

- +
- +
+ + + - - - - + @@ -21320,10 +21320,10 @@
Returns
Documentation generated by JSDoc 3.6.3 - + on June 7, 2020 - +
diff --git a/docs/lib_model.js.html b/docs/lib_model.js.html index f21d833d..d2c4d6a4 100644 --- a/docs/lib_model.js.html +++ b/docs/lib_model.js.html @@ -39,18 +39,18 @@