new ComputedArtifact(allComputedArtifactsnon-null)
Parameters:
Name | Type | Description |
---|---|---|
allComputedArtifacts |
ComputedArtifacts
|
Members
(private) _allComputedArtifacts
(private) _cache
Methods
_assertCorrectNumberOfArtifacts(artifactsnon-null)
Asserts that the length of the array is the same as the number of inputs the class expects
Parameters:
Name | Type | Description |
---|---|---|
artifacts |
Array.<*>
|
_cacheGet(artifactsnon-null) → {*}
Performs a cache.get operation, see _performCacheOperation for more.
Parameters:
Name | Type | Description |
---|---|---|
artifacts |
Array.<*>
|
Returns:
- Type:
-
*
_cacheHas(artifactsnon-null) → {boolean}
Performs a cache.has operation, see _performCacheOperation for more.
Parameters:
Name | Type | Description |
---|---|---|
artifacts |
Array.<*>
|
Returns:
- Type:
-
boolean
_cacheSet(artifactsnon-null, result)
Performs a cache.set operation, see _performCacheOperation for more.
Parameters:
Name | Type | Description |
---|---|---|
artifacts |
Array.<*>
|
|
result |
*
|
_performCacheOperation(artifactsnon-null, cacheOperation)
This is a helper function for performing cache operations and is responsible for maintaing the internal cache structure. This function accepts a path of artifacts, used to find the correct nested cache object, and an operation to perform on that cache with the final key.
The cache is structured with the first argument occupying the keys of the toplevel cache that point to the Map of keys for the second argument and so forth until the 2nd to last argument's Map points to result values rather than further nesting. In the simplest case of a single argument, there is no nesting and the keys point directly to result values.
Map( argument1A -> Map( argument2A -> result1A2A argument2B -> result1A2B ) argument1B -> Map( argument2A -> result1B2A ) )
Parameters:
Name | Type | Description |
---|---|---|
artifacts |
Array.<*>
|
|
cacheOperation |
function
|
compute_(artifact, allComputedArtifactsnon-null) → {*}
Override to implement a computed artifact. Can return a Promise or the computed artifact itself.
Parameters:
Name | Type | Description |
---|---|---|
artifact |
*
|
Input to computation. |
allComputedArtifacts |
ComputedArtifacts
|
Access to all computed artifacts. |
Throws:
Error
Returns:
- Type:
-
*
request(…artifacts) → (non-null) {Promise.<*>}
Request a computed artifact, caching the result on the input artifact.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
artifacts |
*
|
<repeatable> |
Returns:
- Type:
-
Promise.<*>