
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@foundit/broadcasterjs
Advanced tools
Demo app available Demo app source code
No need to initialize separately. Import the 'broadcast' factory function and use to your hearts content.
useEffect(() => {
broadcast.on(['MYBROADCAST-ID', flagReceivedFunction])
}, [flagReceivedFunction])
broacast.on([
'MYBROADCAST-ID',
({ detail }) => {
document.body.append(detail + ' ')
},
])
broacast.once([
'MYBROADCAST-ID',
({ detail }) => {
document.body.append(detail + ' ')
},
])
broacast.off([
'MYBROADCAST-ID',
({ detail }) => {
document.body.append(detail + ' ')
},
])
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
,off
takes an optional third value and emit
takes an optional third argument in the form of a settings object.
{
debug: boolean
debugGlobal: boolean
allowDoublettesSubscribers: boolean
}
Broadcasterjs does prevent doublettes with the same subscriber combination (flag + callback function). If you for some reason would want the same combination on another place in the code either just add a minor change, a comment etc or send in the settings object with allowDoublettesSubscribers
set to true.
FAQs
A simple yet powerful pub/sub pattern javascript event bus
The npm package @foundit/broadcasterjs receives a total of 101 weekly downloads. As such, @foundit/broadcasterjs popularity was classified as not popular.
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.