diff --git a/API.md b/API.md index e1fbef72a2..ddea4e8af6 100644 --- a/API.md +++ b/API.md @@ -152,9 +152,6 @@ openmct.composition.addProvider({ }); ``` - - - ## Using Open MCT When implementing new features, it is useful and sometimes necessary to @@ -193,6 +190,28 @@ a view (or part of a view) selectable: openmct.gestures.selectable(myHtmlElement, myDomainObject); ``` +### Working with Domain Objects + +The [object API]{@link module:openmct.ObjectAPI} provides useful methods +for working with domain objects. + +To make changes to a domain object, use the +[`mutate`]{@link module:openmct.ObjectAPI#mutate} method: + +``` +openmct.objects.mutate(myDomainObject, "name", "New name!"); +``` + +Making modifications in this fashion allows other usages of the domain +object to remain up to date using the +[`observe`]{@link module:openmct.ObjectAPI#observe} method: + +``` +openmct.objects.observe(myDomainObject, "name", function (newName) { + myLabel.textContent = newName; +}); +``` + ## Plugins While you can register new features with Open MCT directly, it is generally