mirror of
https://github.com/nasa/openmct.git
synced 2025-02-22 10:11:06 +00:00
[Creation] Add JSDoc
This commit is contained in:
parent
09bae63de7
commit
f14cad4a39
@ -26,12 +26,22 @@ define(
|
|||||||
function (DomainObjectImpl, uuid) {
|
function (DomainObjectImpl, uuid) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function CreationCapability($injector, domainObject) {
|
/**
|
||||||
|
* Implements the `creation` capability. This allows new domain
|
||||||
|
* objects to be instantiated.
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
|
* @memberof platform/core
|
||||||
|
* @param $injector Angular's `$injector`
|
||||||
|
*/
|
||||||
|
function CreationCapability($injector) {
|
||||||
this.$injector = $injector;
|
this.$injector = $injector;
|
||||||
this.domainObject = domainObject;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Alias of `capabilityService.getCapabilities`; handles lazy loading
|
||||||
|
* of `capabilityService`, since it cannot be declared as a
|
||||||
|
* dependency directly without creating a cycle.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
CreationCapability.prototype.getCapabilities = function (model) {
|
CreationCapability.prototype.getCapabilities = function (model) {
|
||||||
@ -42,12 +52,25 @@ define(
|
|||||||
return this.capabilityService.getCapabilities(model);
|
return this.capabilityService.getCapabilities(model);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiate a new domain object with the provided model.
|
||||||
|
*
|
||||||
|
* This domain object will have been simply instantiated; it will not
|
||||||
|
* have been persisted, nor will it have been added to the
|
||||||
|
* composition of the object which exposed this capability.
|
||||||
|
*
|
||||||
|
* @returns {DomainObject} the new domain object
|
||||||
|
*/
|
||||||
CreationCapability.prototype.create = function (model) {
|
CreationCapability.prototype.create = function (model) {
|
||||||
var id = uuid(),
|
var id = uuid(),
|
||||||
capabilities = this.getCapabilities(model);
|
capabilities = this.getCapabilities(model);
|
||||||
return new DomainObjectImpl(id, model, capabilities);
|
return new DomainObjectImpl(id, model, capabilities);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alias of `create`.
|
||||||
|
* @see {platform/core.CreationCapability#create}
|
||||||
|
*/
|
||||||
CreationCapability.prototype.invoke =
|
CreationCapability.prototype.invoke =
|
||||||
CreationCapability.prototype.create;
|
CreationCapability.prototype.create;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user