New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@jacobtipp/bloc-concurrency

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jacobtipp/bloc-concurrency

## Installation

latest
npmnpm
Version
4.0.3
Version published
Maintainers
1
Created
Source

@jacobtipp/bloc-concurrency

Installation

npm install @jacobtipp/bloc-concurrency

Event Transformers

bloc_concurrency provides an opinionated set of event transformers:

  • concurrent - process events concurrently
  • sequential - process events sequentially
  • restartable - process only the latest event and cancel previous event handlers

Usage

import { Bloc } from "@jacobtipp/bloc";
import { sequential } from "@jacobtipp/bloc-concurrency"

 abstract class CounterEvent {
  protected _!: void
 }

 class CounterIncrementEvent extends CounterEvent {}

export class CounterBloc extends Bloc<CounterEvent, number> {
  constructor() {
    super(0);

    this.on(
      CounterIncrementEvent,
      (event, emit) => {
        emit(this.state + 1);
      },
      /// Specify a custon event transformer from @jacobtipp/bloc-concurrency
      /// in this case events will be processed sequentially 
      sequential()
    );
  }
}

FAQs

Package last updated on 04 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts