From b9651b45d04b9505478dd835ad70e3caee9aa3f3 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 20 Nov 2014 13:56:23 -0800 Subject: [PATCH] [Core] Add JSDoc for ContextualDomainObject Add JSDoc for the domain object wrapper used to expose a 'context' capability; part of ongoing documentation to meet code standards in platform/core in preparation for integration. WTD-573. --- .../src/capabilities/ContextualDomainObject.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/platform/core/src/capabilities/ContextualDomainObject.js b/platform/core/src/capabilities/ContextualDomainObject.js index eeb5b9cf3d..3c25c7082a 100644 --- a/platform/core/src/capabilities/ContextualDomainObject.js +++ b/platform/core/src/capabilities/ContextualDomainObject.js @@ -9,14 +9,28 @@ define( "use strict"; /** + * Wraps a domain object, such that it exposes a `context` capability. + * A domain object may be contained by multiple other domain objects; + * the `context` capability allows two instances of the same domain + * object to be distinguished from one another based on which + * specific instance of a containing object exposed them (by way of a + * `composition` capability.) + * + * @param {DomainObject} domainObject the domain object for which + * context should be exposed + * @param {DomainObject} parentObject the domain object from which + * the wrapped object was retrieved * * @constructor */ function ContextualDomainObject(domainObject, parentObject) { + // Prototypally inherit from the domain object, and + // instantiate its context capability ahead of time. var contextualObject = Object.create(domainObject), contextCapability = new ContextCapability(parentObject, domainObject); + // Intercept requests for a context capability. contextualObject.getCapability = function (name) { return name === "context" ? contextCapability :