* Construct a Sails (app) instance. * * @constructor
()
| 19 | */ |
| 20 | |
| 21 | function Sails() { |
| 22 | |
| 23 | // Inherit methods from EventEmitter |
| 24 | events.EventEmitter.call(this); |
| 25 | |
| 26 | // Remove memory-leak warning about max listeners |
| 27 | // See: http://nodejs.org/docs/latest/api/events.html#events_emitter_setmaxlisteners_n |
| 28 | this.setMaxListeners(0); |
| 29 | |
| 30 | // Keep track of spawned child processes |
| 31 | this.childProcesses = []; |
| 32 | |
| 33 | // Ensure CaptainsLog exists |
| 34 | this.log = CaptainsLog(); |
| 35 | |
| 36 | // Keep a hash of loaded actions |
| 37 | this._actions = {}; |
| 38 | |
| 39 | // Keep a hash of loaded action middleware |
| 40 | this._actionMiddleware = {}; |
| 41 | |
| 42 | // Build a Router instance (which will attach itself to the sails object) |
| 43 | __Router(this); |
| 44 | |
| 45 | // Mixin `load()` method to load the pieces |
| 46 | // of a Sails app |
| 47 | this.load = loadSails(this); |
| 48 | |
| 49 | // Mixin support for `Sails.prototype.after()` |
| 50 | mixinAfter(this); |
| 51 | |
| 52 | // Bind `this` context for all `Sails.prototype.*` methods |
| 53 | this.load = _.bind(this.load, this); |
| 54 | this.request = _.bind(this.request, this); |
| 55 | this.lift = _.bind(this.lift, this); |
| 56 | this.lower = _.bind(this.lower, this); |
| 57 | this.initialize = _.bind(this.initialize, this); |
| 58 | this.exposeGlobals = _.bind(this.exposeGlobals, this); |
| 59 | this.runBootstrap = _.bind(this.runBootstrap, this); |
| 60 | this.isLocalSailsValid = _.bind(this.isLocalSailsValid, this); |
| 61 | this.isSailsAppSync = _.bind(this.isSailsAppSync, this); |
| 62 | this.inspect = _.bind(this.inspect, this); |
| 63 | this.toString = _.bind(this.toString, this); |
| 64 | this.toJSON = _.bind(this.toJSON, this); |
| 65 | this.all = _.bind(this.all, this); |
| 66 | this.get = _.bind(this.get, this); |
| 67 | this.post = _.bind(this.post, this); |
| 68 | this.put = _.bind(this.put, this); |
| 69 | this['delete'] = _.bind(this['delete'], this); |
| 70 | this.getActions = _.bind(this.getActions, this); |
| 71 | this.registerAction = _.bind(this.registerAction, this); |
| 72 | this.registerActionMiddleware = _.bind(this.registerActionMiddleware, this); |
| 73 | this.reloadActions = _.bind(this.reloadActions, this); |
| 74 | |
| 75 | } |
| 76 | |
| 77 | |
| 78 | // Extend from EventEmitter to allow hooks to listen to stuff |
no outgoing calls
no test coverage detected
searching dependent graphs…