mirror of
https://github.com/nasa/openmct.git
synced 2024-12-19 05:07:52 +00:00
[API] Update CompositionCollection to match docs
This commit is contained in:
parent
0cb1ec9366
commit
d4d9f9c467
@ -19,13 +19,16 @@ define([
|
|||||||
* whose composition will be contained
|
* whose composition will be contained
|
||||||
* @param {module:openmct.CompositionProvider} provider the provider
|
* @param {module:openmct.CompositionProvider} provider the provider
|
||||||
* to use to retrieve other domain objects
|
* to use to retrieve other domain objects
|
||||||
|
* @param {module:openmct.CompositionAPI} api the composition API, for
|
||||||
|
* policy checks
|
||||||
* @memberof module:openmct
|
* @memberof module:openmct
|
||||||
* @augments EventEmitter
|
* @augments EventEmitter
|
||||||
*/
|
*/
|
||||||
function CompositionCollection(domainObject, provider) {
|
function CompositionCollection(domainObject, provider, api) {
|
||||||
EventEmitter.call(this);
|
EventEmitter.call(this);
|
||||||
this.domainObject = domainObject;
|
this.domainObject = domainObject;
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
|
this.api = api;
|
||||||
if (this.provider.on) {
|
if (this.provider.on) {
|
||||||
this.provider.on(
|
this.provider.on(
|
||||||
this.domainObject,
|
this.domainObject,
|
||||||
@ -87,6 +90,17 @@ define([
|
|||||||
return this.indexOf(child) !== -1;
|
return this.indexOf(child) !== -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a domain object can be added to this composition.
|
||||||
|
*
|
||||||
|
* @param {module:openmct.DomainObject} child the domain object to add
|
||||||
|
* @memberof module:openmct.CompositionCollection#
|
||||||
|
* @name canContain
|
||||||
|
*/
|
||||||
|
CompositionCollection.prototype.canContain = function (domainObject) {
|
||||||
|
return this.api.checkPolicy(this.domainObject, domainObject);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a domain object to this composition.
|
* Add a domain object to this composition.
|
||||||
*
|
*
|
||||||
@ -168,15 +182,11 @@ define([
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CompositionCollection.prototype.canContain = function (domainObject) {
|
|
||||||
return this.provider.canContain(this.domainObject, domainObject);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop using this composition collection. This will release any resources
|
* Stop using this composition collection. This will release any resources
|
||||||
* associated with this collection.
|
* associated with this collection.
|
||||||
* @name destroy
|
* @name destroy
|
||||||
* @memberof module:openmct.CompositionCollection
|
* @memberof module:openmct.CompositionCollection#
|
||||||
*/
|
*/
|
||||||
CompositionCollection.prototype.destroy = function () {
|
CompositionCollection.prototype.destroy = function () {
|
||||||
if (this.provider.off) {
|
if (this.provider.off) {
|
||||||
|
Loading…
Reference in New Issue
Block a user