🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@apio/bussy

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apio/bussy

An easy event bus with advance features

Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
1
-93.33%
Maintainers
3
Weekly downloads
 
Created
Source

@apio/bussy

An easy events bus with advance features.

Installation

npm i @apio/bussy

Usage

EventBus

Generic events emitter. Support topic wildcards.

import Bussy from '@apio/bussy'

const events = Bussy.createEventBus()

events.on('test.*', () => {
  console.log('Nuovo messaggio')
})

events.emit('test.a')

DataBus

Typed data bus.

import Bussy from '@apio/bussy'

type User = {
  username: string
  password: string
}

const dataBus = Bussy.createDataBus<User>()

data.onData((user: User) => {
  console.log(user.username, user.password)
})

data.publish({ 
  username: 'username',
  password: 'password'
})

Request/Reply

Events bus implementing Request/Reply pattern.

import Bussy from '@apio/bussy'

const chat = Bussy.createReqResBus<string, number>()

chat.onRequest((data, reply) => {
  const len = data.length
  reply(len)
})

chat.request('Ciao', (res, err) => {
  if (err) {
    console.error(err)
  } else {
    console.log(res)
  }
})

Keywords

apio

FAQs

Package last updated on 28 Feb 2025

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