
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.
An event manager very simple
All browser | Backend (Nodejs) | Mobile (React Native) |
---|---|---|
✅ | ✅ | ✅ |
Compatibility with all javascript project
npm install jetemit
const { on, emit } = require("jetemit");
//or
import { on, emit } from "jetemit";
import { emit } from "jetemit";
/**
* emit(name, value);
* name is string
* value any
*/
emit("TIME", "2018-12-01 12:30");
import { on } from "jetemit";
/**
* on(name,function)
* name is string
*/
on("TIME", time => {
console.log(time);
});
import { once } from "jetemit";
/**
* Like on but run one time
*/
once("TIME", time => {
console.log(time);
});
import { on } from "jetemit";
/**
* on return unsubscribe function
*/
const unsubscribe = on("TIME", time => {
console.log(time);
});
unsubscribe();
import { unsubscribeOf } from "jetemit";
/**
* Unsubscribe all subscribed functions for TIME
*/
unsubscribeOf("TIME");
/**
* Unsubscribe a Function which subscribed for TIME
*/
unsubscribeOf("TIME", timeFunction);
Please see this sample:
// file a.js
import { on } from "jetemit";
on("CACHE_STSTEM_HEALTH", () => {
return { state: "OK", id: "CACHE_SYSTEM_1" };
});
// file b.jd
import { on } from "jetemit";
on("CACHE_STSTEM_HEALTH", () => {
return { state: "OK", id: "CACHE_SYSTEM_2" };
});
// file c.js
import { on, emit } from "jetemit";
const status = emit("CACHE_STSTEM_HEALTH");
console.log(status);
/*
[
{ state: "OK", id: "CACHE_SYSTEM_1" },
{ state: "OK", id: "CACHE_SYSTEM_2" }
]
*/
BTC: 1NV1sjQnXwuyHgxQ8G5eWprhxsD5A8yN6r
FAQs
events manager
The npm package jetemit receives a total of 52 weekly downloads. As such, jetemit popularity was classified as not popular.
We found that jetemit 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.