arnaucube
arnaucube/thoughtsPublic Self-hosted repository
thoughts/node_modules/mongoose/lib/ES6Promise.js
node_modules/mongoose/lib/ES6Promise.jsRaw
 1/**
 2 * ES6 Promise wrapper constructor.
 3 *
 4 * Promises are returned from executed queries. Example:
 5 *
 6 *     var query = Candy.find({ bar: true });
 7 *     var promise = query.exec();
 8 *
 9 * DEPRECATED. Mongoose 5.0 will use native promises by default (or bluebird,
10 * if native promises are not present) but still
11 * support plugging in your own ES6-compatible promises library. Mongoose 5.0
12 * will **not** support mpromise.
13 *
14 * @param {Function} fn a function which will be called when the promise is resolved that accepts `fn(err, ...){}` as signature
15 * @api public
16 */
17
18function ES6Promise() {
19  throw new Error('Can\'t use ES6 promise with mpromise style constructor');
20}
21
22ES6Promise.use = function(Promise) {
23  ES6Promise.ES6 = Promise;
24};
25
26module.exports = ES6Promise;