From 381f3d9b69a501e6f22918c3611d82a1ad81b7b6 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 23 Dec 2016 16:40:21 -0800 Subject: [PATCH] [API] Document default composition provider https://github.com/nasa/openmct/issues/1122#issuecomment-252115292 Fixes #1122 --- API.md | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/API.md b/API.md index 9b90f0ef49..a7f6a9d495 100644 --- a/API.md +++ b/API.md @@ -129,8 +129,10 @@ provider. The "composition" of a domain object is the list of objects it contains, as shown (for example) in the tree for browsing. Open MCT provides a -default solution for composition, but there may be cases where you want -to provide the composition of a certain object (or type of object) dynamically. +[default solution](#default-composition-provider) for composition, but there +may be cases where you want to provide the composition of a certain object +(or type of object) dynamically. + For instance, you may want to populate a hierarchy under a custom root-level object based on the contents of a telemetry dictionary. To do this, you can add a new CompositionProvider: @@ -146,6 +148,29 @@ openmct.composition.addProvider({ }); ``` +#### Default Composition Provider + +The default composition provider applies to any domain object with +a `composition` property. The value of `composition` should be an +array of identifiers, e.g.: + +```js +var domainObject = { + name: "My Object", + type: 'folder', + composition: [ + { + key: '412229c3-922c-444b-8624-736d85516247', + namespace: 'foo' + }, + { + key: 'd6e0ce02-5b85-4e55-8006-a8a505b64c75', + namespace: 'foo' + } + ] +}; +``` + ### Adding Telemetry Providers When connecting to a new telemetry source, you will want to register a new