![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
capillaries
Advanced tools
Javascript Events
Installation can be done via package managers such as npm or yarn
% npm install capillaries
# or
% yarn add capillaries
or use cdn
//cdn.jsdelivr.net/npm/capillaries@latest/capillaries.umd.min.js
//cdn.jsdelivr.net/npm/capillaries@latest/capillaries.umd.js
import { Events } from 'capillaries';
const event = new Events();
const listener = function (payload) {
console.log('Event Received:', payload);
};
const anotherListener = function (payload) {
console.log('Event Received:', payload);
};
// create a event listeners
event.on('connecting', listener);
event.on('connected', anotherListener, this); // optionally bind context to the listener when invoked
// dispatch events
event.emit('connected', 'paylod');
// remove a event listener
const unsubscribe = event.off('connected', listener);
unsubscribe();
// remove all listeners for an event
event.off('connected');
// unbind all event listeners
event.unbindAll();
import { Hooks } from 'capillaries';
const hooks = new Hooks();
// create a tap
hooks.tap('HookName', () => {
return 'Hello World';
});
// Calling the taps
hooks.call('HookName', payload); //-> returns undefined
hooks.callWaterFall('HookName', payload); //-> returns 'Hello world'
hooks.callAsync('HookName', payload); // awaits on taps, returns undefined
hooks.callAsyncWaterFall('HookName', payload); // awaits on taps, returns 'Hello world'
Hooks are executed in order. The waterfall passes a return value from each function to the next function and returns final retuned data
FAQs
Javascript Events
The npm package capillaries receives a total of 8 weekly downloads. As such, capillaries popularity was classified as not popular.
We found that capillaries demonstrated a healthy version release cadence and project activity because the last version was released less than 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.