Class: Service

Services. Service

A base prototype for a service. All other services should extend this one or implement every method that it implements.

new Services.Service()

/Users/justin/src/service.js/service.js, line 305
Example
var MyService = Object.create(Services.Service);
// This uses underscore.js, which is not required.
_.extend(MyService, {
  onStart: function() {
    // Do everything needed to start running.
  },
  myMethod: function() {
    //...
  }
});

Methods

staticServices.Service.isUsable(){Q.promise|boolean}

/Users/justin/src/service.js/service.js, line 334

Called to determine whether this implementation can be used in the current environment.

Returns:
a promise if figuring out the answer is asynchronous. This should either return a truthy or falsy value or return a promise that will resolve to a truthy or falsy value.

staticServices.Service.onInitialize()

/Users/justin/src/service.js/service.js, line 309

Called when object is first created. Must be synchronous.

staticServices.Service.onStart(){Q.promise|undefined}

/Users/justin/src/service.js/service.js, line 318

Called when service is being started.

Returns:
return a promise if startup involves an asynchronous action.

staticServices.Service.onStop()

/Users/justin/src/service.js/service.js, line 323

Called when the service is being stopped.