
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.
event-message-center
Advanced tools
基于 JS 发布订阅模式实现的一个事件消息中心
https://hunter1024.blog.csdn.net/article/details/124452792
npm install event-message-center
或
yarn add event-message-center
或
pnpm install event-message-center
import { messageCenter } from "event-message-center";
const { messageCenter } = require("event-message-center");
<script src="./node_modules/event-message-center/dist/umd/index.js"></script>
<script>
console.log(MessageCenter);
</script>
const bus = new MessageCenter();
const bus = messageCenter;
messageCenter.on("a", funcA);
messageCenter.emit("a", { state: "stop" });
messageCenter.un("a", funcA);
messageCenter.un("a");
messageCenter.once("a", funcA);
messageCenter.clear();
messageCenter.has("a");
messageCenter.handlerLength("a");
messageCenter.watch("b", funcB);
messageCenter.invoke("b", { num1: 1, num2: 2 }).then((result) => {
console.log(result);
});
const messageCenter2 = new MessageCenter({ blackList: ["c"], maxLen: 2 });
messageCenter2.on("c", () => {}); // c is not allow
messageCenter2.on("b", () => {});
messageCenter2.on("b", () => {});
messageCenter2.on("b", () => {}); // the number of b must be less than 2
FAQs
The npm package event-message-center receives a total of 3 weekly downloads. As such, event-message-center popularity was classified as not popular.
We found that event-message-center 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.