Socket
Book a DemoInstallSign in
Socket

light-pub-sub

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

light-pub-sub

Simple pub/sub for Javascript

latest
Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

light-pub-sub

Light pub/sub library for Javascript

Quick Start

const broadcaster = require('light-pub-sub')

// subscribe
broadcaster.on('abc', ({ data }) => {
  console.log(data) // 123
})

// publish
broadcaster.emit('abc', 123)

Usage

broadcaster.on(channel, fn)

broadcaster.once(channel, fn)

broadcaster.emit(channel, data)

broadcaster.off(channel, fn)

broadcaster.offAll(channel)

Keywords

pub

FAQs

Package last updated on 16 May 2020

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