npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

u-node-mq

v4.0.0

Published

基于发布订阅模型的消息通信插件

Downloads

158

Readme

文档目录结构

文档内容

u-node-mq 是什么?

u-node-mq是用来解决前端项目中数据异步通信问题的工具,可以准确的将一个模块的数据传到另一个模块,就像rabbitMQ使用发布订阅模型的中间件一样,使用u-node-mq可以完全解耦前端模块的耦合;

其他

  • u-node-mq在文档和代码注释中有时也会写成简写unmq

  • u-node-mq中的u是标识词;node是最初创建项目的执行环境是 node,但是后面经过使用 ts 升级和重构,现在已经升级到可以在所有 js 环境中执行;mqmessage queue的简写;

  • 其他信息

npm 安装

pnpm add u-node-mq

or

yarn add u-node-mq

or

npm install u-node-mq

u-node-mq 基本使用方法

unmq.js

import UNodeMQ, { Exchange, Queue } from "u-node-mq";

//声明交换机ex1,以及队列qu1
const unmq = new UNodeMQ({ ex1: new Exchange({ routes: ["qu1"] }) }, { qu1: new Queue() });

export default unmq;

//可以挂到抬手就摸得到的位置

// Vue.prototype.unmq = unmq;  //(Vue 2.x)

// const app = createApp({})
// app.config.globalProperties.unmq = unmq     //(Vue 3.x)

模块 A.js

import unmq from "unmq.js";

//发送数据
unmq.emit("ex1", "消息内容1", "消息内容2");

模块 B.js

import unmq from "unmq.js";

//接收并消费数据
unmq.on("qu1", getData);

function getData(data) {
  console.log(data);
}

了解更多详细内容

TODO