Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
cleanup-util
Advanced tools
Utility for cleaning up event handlers
cleanup-util is a small, utility for tracking and cleaning up event handlers. I find this utility useful when I have classes derived from EventHandler that are used throughout the life of my applications and those EventHandlers frequently have event handlers added and removed. It helps me catch memory leaks from dangling event listeners early in the development process. I hope you find it useful.
cleanup-util is installed using npm:
npm install -S cleanup-util
In the above command we install cleanup-util into the local project, updating the dependencies in the project.json
file.
function cleanupPropagationEvent<T extends EventEmitter>(
sender: T,
event: string,
listener: Listener,
target: EventEmitter,
reciprocal?: string,
): void;
Attaches the specified listener
to the specified sender
, wrapping the listener
to track it's cleanup.
If reciprocal
is specified, it is the name of an event on target
, cleanup-util will attach an event handler to the target to cleanup in the background if necessary.
function addCleanupTask<S extends EventEmitter, T>(
sender: S,
target: T,
task: Task,
): void;
Adds a task to be run when the cleanup propagation event occurs.
Associates an instance Id with a target object.
Gets the instance Id associated with an object.
Clears the instance Id associated with an object.
Tests are built using Jest; we're near 100%!
npm test
This project is licensed by the MIT license found in this repository's root.
FAQs
A utility for cleaning up event handlers in nodejs.
The npm package cleanup-util receives a total of 3 weekly downloads. As such, cleanup-util popularity was classified as not popular.
We found that cleanup-util 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
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.