
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.
arbitrary-emitter
Advanced tools
Event emitter with Map/Set sugar for browser and node.js apps
arbitrary-emitter allows to use arbitrary values as keys for your events
arbitrary-emitter is written in vanilla ES6, so maybe you want to transpile it before using it.
Project in active development, API may change
const emitter = arbitraryEmitter()
Add a listener for key
which will trigger method
function.
key
can be any type of value.
add
returns unsubscribe method
const obj = {}
let unsubscribe = emitter.add(obj, () => doSomething())
emitter.trigger(obj) // will `doSomething`
unsubscribe()
emitter.trigger(obj) // won't do anything
Add a listener for key
which will trigger method
function just one time, then listener will be removed.
key
can be any type of value
const obj = {}
emitter.addOnce(obj, () => doSomethingOnce())
emitter.trigger(obj) // will `doSomething`
emitter.trigger(obj) // won't do anything
Trigger methods binded to key
emitter.trigger(obj)
npm test
© 2016 Jacobo Tabernero - Released under MIT License
FAQs
Map based event emitter in ~350 bytes
The npm package arbitrary-emitter receives a total of 2 weekly downloads. As such, arbitrary-emitter popularity was classified as not popular.
We found that arbitrary-emitter 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.