@universal-packages/dynamic-api
Advanced tools
Comparing version 1.7.10 to 1.8.0
@@ -110,3 +110,3 @@ "use strict"; | ||
this.constructor['debugLog'].push(debugEntry); | ||
if (this.options.accumulate) { | ||
if (results.length > 1) { | ||
return results; | ||
@@ -113,0 +113,0 @@ } |
{ | ||
"name": "@universal-packages/dynamic-api", | ||
"version": "1.7.10", | ||
"version": "1.8.0", | ||
"description": "Dynamic decoupling-adapting system", | ||
@@ -26,3 +26,3 @@ "author": "David De Anda <david@universal-packages.com> (https://github.com/universal-packages)", | ||
"@types/node": "^18.11.9", | ||
"@universal-packages/maintenance": "^1.5.2", | ||
"@universal-packages/maintenance": "^1.6.3", | ||
"jest": "^29.7.0", | ||
@@ -29,0 +29,0 @@ "prettier": "^3.0.3", |
@@ -50,3 +50,3 @@ # Dynamic API | ||
- **`accumulate`** `Boolean` | ||
By default only the first dynamic with a given name will be performed and the retuning valued bt it will be returned to the user. | ||
By default only the first dynamic with a given name will be performed and the retuning value will be returned to the user. | ||
When `accumulate` is true all dynamics with the same name will be performed and all the results will be accumulated in an array and returned to the user. | ||
@@ -83,4 +83,4 @@ | ||
export default class CalculateDynamic { | ||
public async perform(payload) { | ||
if(payload.fast) { | ||
async perform(payload) { | ||
if (payload.fast) { | ||
return 'I did it fast' | ||
@@ -101,5 +101,4 @@ } else { | ||
export default class CalculateDynamic { | ||
public async perform(payload, dynamicApi) { | ||
if(payload.fast) { | ||
async perform(payload, dynamicApi) { | ||
if (payload.fast) { | ||
const speed = await dynamicApi.performDynamic('calculate-speed', { fast: true }) | ||
@@ -122,4 +121,4 @@ | ||
export default class CalculateDynamic { | ||
public async perform(payload) { | ||
if(payload.fast) { | ||
async perform(payload) { | ||
if (payload.fast) { | ||
return 'I did it fast' | ||
@@ -142,3 +141,3 @@ } else { | ||
export default class AfterCalculateDynamic { | ||
public async perform(payload) { | ||
async perform(payload) { | ||
console.log('A calculation was made with:', payload) | ||
@@ -156,3 +155,3 @@ } | ||
export default class AfterCalculateDynamic { | ||
public async perform(payload, result) { | ||
async perform(payload, result) { | ||
console.log('A calculation was made with:', payload, 'and with result:', result) | ||
@@ -170,3 +169,3 @@ } | ||
export default class BeforeCalculateDynamic { | ||
public async perform(payload, dynamicApi) { | ||
async perform(payload, dynamicApi) { | ||
console.log('about to calculate with:', payload) | ||
@@ -187,5 +186,5 @@ await dynamicApi.performDynamic('prepare-data') | ||
export default class CalculateDynamic { | ||
public async perform(payload, dynamicApi) { | ||
async perform(payload, dynamicApi) { | ||
dynamicApi.emit('event', 'A calculation was done') | ||
if(payload.fast) { | ||
if (payload.fast) { | ||
return 'I did it fast' | ||
@@ -192,0 +191,0 @@ } else { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33222
233