
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@foundit/broadcasterjs
Advanced tools
easy to use
framework agnostic
minimal footprint
optimised for SPA applications
unintrusive as a dependency
no own dependencies
Here you can report issues or contribute
No need to initialize separately. Import the 'broadcast' factory function and use to your hearts content.
npm install @foundit/broadcasterjs
import { broadcast } from '@foundit/broadcasterjs'
useEffect(() => {
return broadcast.on(['MYBROADCAST-ID', myFlagEmittedCallbackFunction])
}, [myFlagEmittedCallbackFunction])
broadcast.on()
returns a unsubscribe function which comes in handy when you want to cleanup on component unmount. If your listener handler function does not depend on the React component it is instanciated, in you can of course omit the return
to make it persist.
const off() = broadcast.on([
'MYBROADCAST-ID',
({ detail }) => {
document.body.append(detail + ' ')
},
])
const off() = broadcast.once([
'MYBROADCAST-ID',
({ detail }) => {
document.body.append(detail + ' ')
},
])
off() // Use the subscribers return function.
broadcast.emit('MYBROADCAST-ID', 'Hello world')
Click elements tab i chrome devtools, select event-listeners tab in second pane. Active listeners begin with 'broadcast-' + flag name. Expand each listener to see each unique subscriber.
Add ?debug=broadcasterjs
to your url and open your devtools console.
The broadcaster functions on
,once
takes an optional third value and emit
takes an optional third argument in the form of a settings object.
{
debug: boolean (false)
debugGlobal: boolean (false)
allowDoublettesSubscribers: boolean (false)
useLatestSubscriberScope?: boolean (false) // <- internal use
suppresDebug?: boolean (false) // <- internal use
}
v 1.1.0 The subscribe functions 'on' and 'once' now return a unsubscribe function (no arguments) that is much more user friendly than the previous off function. 'off' is still available but removed from the documentation.
Publish to npm: npm publish --access=public
Compile typescript: tsc
Develop: yarn start
FAQs
A simple yet powerful pub/sub pattern javascript event bus
We found that @foundit/broadcasterjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.