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 🙏

© 2025 – Pkg Stats / Ryan Hefner

electron-vue-event-manager

v0.0.5

Published

跨 Vue 组件及跨 electron 窗口的事件监听管理器

Downloads

8

Readme

electron-vue-event-manager

基于 electron-vue 的事件监听系统

当前版本为自用版,有很多问题、考虑不全的地方

功能:

  1. vue 组件之间的消息传递
  2. electron 主线程与渲染线程的消息传递
  3. electron 窗口之间的消息传递

导入

import EventManager from 'electron-vue-event-manager'

初始化

主线程

background.ts 初始化

// 添加 主线程 事件监听
// 需要把所有创建的窗口传进去
EventManager.Instance().mainInit([
  {
    // 创建的窗口,类型 BrowserWindow
    window: window1,
    // 类型,唯一标示
    type: 'window1'
  },
  {
    window: window2,
    type: 'window2'
  }
])

渲染线程

渲染线程的消息传递需要主线程转发

以下初始化是为了监听主线程

EventManager.Instance().rendererInit()

监听

在任何位置添加监听器,即可监听来自任何地方的广播消息

// Window1 添加监听事件
EventManager.Instance().addEventListener<string>(
  EventType.Window1SendMessage,
  (window2Message) => {
    console.log('接收到来自 Window2 的消息:', window2Message)
  }
)

addEventListener 可以接收最多5个泛型,用于回调参数的类型约束

广播

// Window2 触发广播
EventManager.Instance().broadcast<string>(
  EventType.Window1SendMessage,
  '我是 Window2'
)

上面的 EventType 是枚举类型,也可以直接写string