diff --git a/src/api/annotation/AnnotationAPI.js b/src/api/annotation/AnnotationAPI.js index b93ec0c0ff..e5b52e731e 100644 --- a/src/api/annotation/AnnotationAPI.js +++ b/src/api/annotation/AnnotationAPI.js @@ -95,7 +95,6 @@ export default class AnnotationAPI extends EventEmitter { this.availableTags = {}; this.namespaceToSaveAnnotations = ''; this.#targetComparatorMap = new Map(); - this.annotatableTypes = []; this.ANNOTATION_TYPES = ANNOTATION_TYPES; this.ANNOTATION_TYPE = ANNOTATION_TYPE; @@ -116,17 +115,6 @@ export default class AnnotationAPI extends EventEmitter { domainObject.annotationType = domainObject.annotationType || 'plotspatial'; } }); - - this.openmct.on('start', () => { - const types = this.openmct.types.getTypes(); - const typeKeys = Object.keys(types); - - typeKeys.forEach((key) => { - if (types[key].definition.annotatable) { - this.annotatableTypes.push(key); - } - }); - }); } /** * Creates an annotation on a given domain object (e.g., a plot) and a set of targets (e.g., telemetry objects) @@ -601,6 +589,8 @@ export default class AnnotationAPI extends EventEmitter { * @returns {boolean} Returns true if the type is annotatable */ isAnnotatableType(type) { - return this.annotatableTypes.some((annotatableType) => annotatableType === type); + const types = this.openmct.types.getAllTypes(); + + return types[type]?.definition?.annotatable; } } diff --git a/src/api/types/TypeRegistry.js b/src/api/types/TypeRegistry.js index 4ed36a2f1a..45928f8724 100644 --- a/src/api/types/TypeRegistry.js +++ b/src/api/types/TypeRegistry.js @@ -93,7 +93,7 @@ export default class TypeRegistry { * List all registered types. * @returns {Type[]} all registered types */ - getTypes() { + getAllTypes() { return this.types; } /**