loopback/node_modules/connection/lib/connection.js

42 lines
845 B
JavaScript

/**
* Expose `Connection`.
*/
module.exports = Connection;
/**
* Module dependencies.
*/
var AsteroidModule = require('asteroid-module')
, debug = require('debug')('connection')
, util = require('util')
, inherits = util.inherits
, assert = require('assert');
/**
* Create a new `Connection` with the given `options`.
*
* @param {Object} options
* @return {Connection}
*/
function Connection(options) {
AsteroidModule.apply(this, arguments);
this.options = options;
// inheriting connections must provide an adapter
// otherwise throw when this connection's adapter
// is used...
this.adapter = function () {
throw new Error('connection has not provided an adapter!');
}
debug('created with options', options);
}
/**
* Inherit from `AsteroidModule`.
*/
inherits(Connection, AsteroidModule);