How to use the @boost/event.ConcurrentEvent function in @boost/event

To help you get started, we’ve selected a few @boost/event examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github beemojs / beemo / packages / core / src / Driver.ts View on Github external
onMergeConfig = new Event<[ConfigContext, Config]>('merge-config');

  onCreateConfigFile = new Event<[ConfigContext, Path, Config]>('create-config-file');

  onCopyConfigFile = new Event<[ConfigContext, Path, Config]>('copy-config-file');

  onReferenceConfigFile = new Event<[ConfigContext, Path, Config]>('reference-config-file');

  onDeleteConfigFile = new Event<[ConfigContext, Path]>('delete-config-file');

  onBeforeExecute = new ConcurrentEvent<[DriverContext, Argv]>('before-execute');

  onAfterExecute = new ConcurrentEvent<[DriverContext, unknown]>('after-execute');

  onFailedExecute = new ConcurrentEvent<[DriverContext, Error]>('failed-execute');

  blueprint(predicates: Predicates) /* infer */ {
    // eslint-disable-next-line
    return {
      args: array(string()),
      dependencies: array(string()),
      env: object(string()),
      strategy: string(STRATEGY_NATIVE).oneOf([
        STRATEGY_NATIVE,
        STRATEGY_CREATE,
        STRATEGY_REFERENCE,
        STRATEGY_COPY,
        STRATEGY_NONE,
      ]),
    } as $FixMe;
  }
github beemojs / beemo / packages / core / src / Driver.ts View on Github external
onLoadPackageConfig = new Event<[ConfigContext, Config]>('load-package-config');

  onMergeConfig = new Event<[ConfigContext, Config]>('merge-config');

  onCreateConfigFile = new Event<[ConfigContext, Path, Config]>('create-config-file');

  onCopyConfigFile = new Event<[ConfigContext, Path, Config]>('copy-config-file');

  onReferenceConfigFile = new Event<[ConfigContext, Path, Config]>('reference-config-file');

  onDeleteConfigFile = new Event<[ConfigContext, Path]>('delete-config-file');

  onBeforeExecute = new ConcurrentEvent<[DriverContext, Argv]>('before-execute');

  onAfterExecute = new ConcurrentEvent<[DriverContext, unknown]>('after-execute');

  onFailedExecute = new ConcurrentEvent<[DriverContext, Error]>('failed-execute');

  blueprint(predicates: Predicates) /* infer */ {
    // eslint-disable-next-line
    return {
      args: array(string()),
      dependencies: array(string()),
      env: object(string()),
      strategy: string(STRATEGY_NATIVE).oneOf([
        STRATEGY_NATIVE,
        STRATEGY_CREATE,
        STRATEGY_REFERENCE,
        STRATEGY_COPY,
        STRATEGY_NONE,
      ]),
github beemojs / beemo / packages / core / src / Driver.ts View on Github external
onLoadModuleConfig = new Event<[ConfigContext, Path, Config]>('load-module-config');

  onLoadPackageConfig = new Event<[ConfigContext, Config]>('load-package-config');

  onMergeConfig = new Event<[ConfigContext, Config]>('merge-config');

  onCreateConfigFile = new Event<[ConfigContext, Path, Config]>('create-config-file');

  onCopyConfigFile = new Event<[ConfigContext, Path, Config]>('copy-config-file');

  onReferenceConfigFile = new Event<[ConfigContext, Path, Config]>('reference-config-file');

  onDeleteConfigFile = new Event<[ConfigContext, Path]>('delete-config-file');

  onBeforeExecute = new ConcurrentEvent<[DriverContext, Argv]>('before-execute');

  onAfterExecute = new ConcurrentEvent<[DriverContext, unknown]>('after-execute');

  onFailedExecute = new ConcurrentEvent<[DriverContext, Error]>('failed-execute');

  blueprint(predicates: Predicates) /* infer */ {
    // eslint-disable-next-line
    return {
      args: array(string()),
      dependencies: array(string()),
      env: object(string()),
      strategy: string(STRATEGY_NATIVE).oneOf([
        STRATEGY_NATIVE,
        STRATEGY_CREATE,
        STRATEGY_REFERENCE,
        STRATEGY_COPY,
github beemojs / beemo / packages / core / src / Script.ts View on Github external
import { Plugin, Task, TaskAction } from '@boost/core';
import { ConcurrentEvent } from '@boost/event';
import { Options } from 'yargs-parser';
import execa, { Options as ExecaOptions, ExecaReturnValue } from 'execa';
import ScriptContext from './contexts/ScriptContext';
import { Argv, ExecuteType, ExecuteQueue } from './types';

export default abstract class Script<
  Args extends object = {},
  Opts extends object = {}
> extends Plugin {
  tasks: Task[] = [];

  onBeforeExecute = new ConcurrentEvent<[ScriptContext, Argv]>('before-execute');

  onAfterExecute = new ConcurrentEvent<[ScriptContext, unknown]>('after-execute');

  onFailedExecute = new ConcurrentEvent<[ScriptContext, Error]>('failed-execute');

  /**
   * Define a configuration object to parse args with.
   */
  args(): Options {
    return {};
  }

  /**
   * Execute the script with the context and parsed args.
   */
  async execute(context: ScriptContext, args: Args): Promise {
github beemojs / beemo / packages / core / src / Script.ts View on Github external
import { Plugin, Task, TaskAction } from '@boost/core';
import { ConcurrentEvent } from '@boost/event';
import { Options } from 'yargs-parser';
import execa, { Options as ExecaOptions, ExecaReturnValue } from 'execa';
import ScriptContext from './contexts/ScriptContext';
import { Argv, ExecuteType, ExecuteQueue } from './types';

export default abstract class Script<
  Args extends object = {},
  Opts extends object = {}
> extends Plugin {
  tasks: Task[] = [];

  onBeforeExecute = new ConcurrentEvent<[ScriptContext, Argv]>('before-execute');

  onAfterExecute = new ConcurrentEvent<[ScriptContext, unknown]>('after-execute');

  onFailedExecute = new ConcurrentEvent<[ScriptContext, Error]>('failed-execute');

  /**
   * Define a configuration object to parse args with.
   */
  args(): Options {
    return {};
  }

  /**
   * Execute the script with the context and parsed args.
   */
  async execute(context: ScriptContext, args: Args): Promise {
    return this.executeTasks('serial');
  }
github beemojs / beemo / packages / core / src / Script.ts View on Github external
import { Options } from 'yargs-parser';
import execa, { Options as ExecaOptions, ExecaReturnValue } from 'execa';
import ScriptContext from './contexts/ScriptContext';
import { Argv, ExecuteType, ExecuteQueue } from './types';

export default abstract class Script<
  Args extends object = {},
  Opts extends object = {}
> extends Plugin {
  tasks: Task[] = [];

  onBeforeExecute = new ConcurrentEvent<[ScriptContext, Argv]>('before-execute');

  onAfterExecute = new ConcurrentEvent<[ScriptContext, unknown]>('after-execute');

  onFailedExecute = new ConcurrentEvent<[ScriptContext, Error]>('failed-execute');

  /**
   * Define a configuration object to parse args with.
   */
  args(): Options {
    return {};
  }

  /**
   * Execute the script with the context and parsed args.
   */
  async execute(context: ScriptContext, args: Args): Promise {
    return this.executeTasks('serial');
  }

  /**

@boost/event

An event system with multiple emitter patterns.

MIT
Latest version published 9 months ago

Package Health Score

58 / 100
Full package analysis