
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Small message bus and a package used by jaxs (for pub/sub).
There is a surprising absence of small and flexible message buses for the client side. This is a small but purpose built message bus. The purpose is to decouple rendering in jsx from any other concerns in the Jaxs library. It could be used for other things, because it's just a little message bus.
The main joy of this little library is that it can match event names via:
A lot of other libraries build little namespacing DSLs, but for me the superset of needs is fuzzy vs exact matches. How the fuzzy matches happens is up to you via regexes which are powerful and sometimes even expressive.
import { createBus } from 'jaxs-bus'
const exactListener = (payload, listenerOptions) => {
console.log(`Exact listener: ${listenerOptions.eventName} ${payload}`)
}
const fuzzyListener = (payload, listenerOptions) => {
console.log(`Fuzzy listener: ${listenerOptions.eventName} ${payload}`)
}
const bus = createBus()
bus.subscribe('exactly', exactListener)
bus.subscribe(/ex.*/, fuzzyListener)
bus.publish('extra', 'extra-payload')
// logged string:
// Fuzzy listener: extra extra-payload
bus.publish('exactly', 'exactly-payload')
// logged string:
// Exact listener: exactly exactly-payload
// Fuzzy listener: exactly exactly-payload
Fuzzy listeners are good for things that could be called middleware. For example, if you wanted to debug events passing through the system you could subscribe to everything and log out the data you were interested in understanding:
const unsubscribe = bus.subscribe(/.*/, console.log)
When you are done with your debuggery, you can go ahead and unsubscribe and the logging will stop.
unsubscribe()
Another good use of fuzzy matcher would be something that does something before or after certain events. For example, if you were to create a data namespace, and everytime a prefaced data event comes in you could save to local storage.
bus.subscribe(/data:+./, saveToLocalStorage)
bus.publish('not-relevant', {ignore: 'me'}) // ignored by storage efforts
bus.publish('data:new-user', {user: {name: 'Kane'}}) // calls function!
This is an npm module at npmjs. Use your favorite package manager to download and consume.
It is setup for both umd and es6 imports, plus a types file.
It's also very small, dist js is 75 brief lines.
FAQs
Small message bus and a package used by jaxs (for pub/sub)
We found that jaxs-bus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.