File

libs/ngx-pfe/pfe-actions/trigger-service-activators/trigger-service-activators.service.ts

Index

Properties
Accessors

Properties

Public executeActionTriggerServiceActivators
Default value : () => {...}

Accessors

serviceActivatorService
setserviceActivatorService(service: PfeServiceActivatorService)
Parameters :
Name Type Optional
service PfeServiceActivatorService No
Returns : void
import { Injectable } from '@angular/core';
import { PfeServiceActivatorService } from './../../pfe-service-activator/service/service-activator.service';
import { PfeTriggerServiceActivatorsActionConfig } from './trigger-service-activators.model';

@Injectable()
export class PfeTriggerServiceActivatorsService {
  protected pfeServiceActivatorsService: PfeServiceActivatorService | undefined;

  public set serviceActivatorService(service: PfeServiceActivatorService) {
    this.pfeServiceActivatorsService = service;
  }

  public executeActionTriggerServiceActivators = async (actionConfig: PfeTriggerServiceActivatorsActionConfig): Promise<void> => {
    if (!this.pfeServiceActivatorsService) {
      throw new Error('serviceActivatorService not available');
    } else {
      await this.pfeServiceActivatorsService.spreadWithGlobalServiceActivatorConfig(actionConfig.serviceActivators);
      await this.pfeServiceActivatorsService.handleServiceActivators(
        actionConfig.serviceActivators,
        actionConfig.executeServiceActivatorsSequential
      );
      return Promise.resolve();
    }
  };
}

results matching ""

    No results matching ""