![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
capillaries
Advanced tools
Javascript Events and Hooks
Installation can be done via package managers such as npm or yarn
% npm install capillaries
# or
% yarn add capillaries
import { Events } from 'capillaries';
const event = new Events();
const listener = function (payload) {
console.log('Event Received:', payload);
};
// create a event listeners
event.on('connecting', listener);
event.on('connected', listener, this); // optionally bind context to the listener when invoked
// listen to all events
event.on('*', (type, payload) => {});
// dispatch events
event.emit('connected', 'paylod');
// remove a event listener
const unsubscribe = event.on('connected', listener);
unsubscribe();
// remove all listeners for given event
event.unbindAll('connected');
// unbind all event listeners
event.unbindAll();
import { AsyncEvents } from 'capillaries';
const event = new AsyncEvents();
const handler = async function (payload) {
console.log('Event Received:', payload);
};
// create a event handler
event.on('connected', handler);
// call the event
await event.call('connected', 'paylod');
// remove a event listener
const unsubscribe = event.on('connected', handler);
unsubscribe();
// unbind/remove all events
event.unbindAll();
Only one event handler can be attached per event. Attaching more than one event will throw an error.
import { Hooks } from 'capillaries';
const hooks = new Hooks();
// create a tap
hooks.tap('Hook', () => {
return 'Hello World!';
});
hooks.tap('AsyncHook', async () => {
return 'Hello World!';
});
// Call the taps
hooks.call('Hook', payload); //-> returns undefined
hooks.callWaterFall('Hook', payload); //-> returns 'Hello World!'
hooks.callAsync('AsyncHook', payload); // awaits on taps, returns undefined
hooks.callAsyncWaterFall('AsyncHook', payload); // awaits on taps, returns 'Hello World!'
// remove all hooks
hooks.clear();
Hooks are executed in order. The calling waterfall hook passes a return value from each function to the next function and returns data from the last tap
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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.