![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.
emitter-master
Advanced tools
Support for offline publishing and subscribing events
import { Emitter } from "emitter-master"
Emitter.sender("A<->B", 123) // You can send before you receive, which is a characteristic of the library
const ret = await Emitter.receiver("A<->B" ) // This is returned immediately in any case, or null in the case of no value
// or
Emitter.receiver("A<->B",function(val){
console.log(val)
})
// clear
Emitter.clear("A<->B")
function handle({event_name, data}){
if(event_name === "A->B"){
...
}else if(event_name === "B->C"){
...
}else{
...
}
}
Emitter.receiver(["A->B", "B->C"], handle)
Emitter.clear(["A->B", "B->C"], handle)
sender has an alias called trigger
receiver has an alias called listener
once indicates that the system listens only once
Depending on your scenario, the name you use will provide better semantics.
The first thing to be clear is that the library is not framework-related, but many front ends now use vue and react to build websites, so here is my recommendation
**Suggestion 1:**Define the event_name.ts file to store the event name. This file only defines the event name and the comment of the event name. Note that each event name must have A comment, otherwise it is meaningless. The form 'A<->B' indicates that A and B send data to each other. Here is an example
// This describes what the event does, so you can see the details in the ide with a quick preview
const CompA_CompB = "CompA->CompB"
export {
CompA_CompB
}
Suggestion 2: For non-component-to-component communication that still explicitly specifies the source and destination, such as when I send to component CompA in Axios encapsulation, I can name it:Axios->CompA
**Suggestion 3:**Remember to clear events before the component uninstalls
import {Emitter} from "emitter-master"
Emitter.sender( "a-b" , true); // Comment this out ret will be null, and uncomment will be true
( async function ()
{
const ret = await Emitter.receiver( "a-b" );
console.log("ret")
console.log( ret ); // true
} )();
FAQs
Support for offline event emitters, event, listener
The npm package emitter-master receives a total of 6 weekly downloads. As such, emitter-master popularity was classified as not popular.
We found that emitter-master 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
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.