Socket
Socket
Sign inDemoInstall

brcast

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brcast

Tiny data broadcaster with 0 dependencies


Version published
Weekly downloads
498K
decreased by-7.22%
Maintainers
1
Weekly downloads
 
Created

What is brcast?

The 'brcast' npm package is a small library for creating a broadcast system. It allows you to create a broadcaster that can notify listeners of changes. This is particularly useful for managing state changes in applications, especially in the context of React or other component-based frameworks.

What are brcast's main functionalities?

Creating a Broadcaster

This feature allows you to create a broadcaster with an initial state. The broadcaster can then be used to manage and notify listeners of state changes.

const createBroadcast = require('brcast');
const broadcast = createBroadcast(initialState);

Subscribing to Changes

This feature allows you to subscribe to state changes. The provided callback function will be called whenever the state changes, allowing you to react to those changes.

const unsubscribe = broadcast.subscribe((state) => {
  console.log('State changed:', state);
});

Updating the State

This feature allows you to update the state of the broadcaster. All subscribed listeners will be notified of the new state.

broadcast.setState(newState);

Unsubscribing from Changes

This feature allows you to unsubscribe from state changes, stopping the callback function from being called when the state changes.

unsubscribe();

Other packages similar to brcast

Keywords

FAQs

Package last updated on 19 Apr 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc