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

qiao-electron

v3.9.0

Published

electron tools

Downloads

527

Readme

qiao-electron

npm version npm downloads

封装了一些常见的 electron 主进程操作,详见:一篇文章学会 Electron

install

npm i qiao-electron

ipc

提供了一些在渲染进程中可以使用的常见方法

appGetVersionIPC

// 获取app版本号
const res = await window.electron.appGetVersionIPC();

darkModeChangeIPC

// 监听mac下黑夜模式的变化
darkModeChangeIPC((isDark) => {
  console.log(isDark);
});

darkModeGetIPC

// 获取mac下当前的黑夜模式状态
const res = await window.electron.darkModeGetIPC();

darkModeGetIPC

// 获取mac下当前的黑夜模式状态
const res = await window.electron.darkModeGetIPC();

dialogOpenFolderIPC

// 打开选择文件夹的dialog,如果选择了文件夹,返回具体的path
const res = await window.electron.dialogOpenFolderIPC();

fsRmIPC

// 删除文件或文件夹
const res = await window.electron.fsRmIPC(rmPath);

fsMkdirIPC

// 创建一个文件夹
const res = await window.electron.fsMkdirIPC(dir);

fsRenameIPC

// 重命名一个文件或文件夹
const res = await window.electron.fsRenameIPC(oldPath, newPath);

fsGetTreeIPC

// 获取某个文件夹下的文件树
const res = await window.electron.fsGetTreeIPC(dir, ignores);

fsReadFileIPC

// 获取某个文件的内容,直接返回
const res = await window.electron.fsReadFileIPC(filePath);

fsWriteFileIPC

// 写一个文件
const res = await window.electron.fsWriteFileIPC(filePath, fileData);

logIPC

// 写本地日志
const res = await window.electron.logIPC(msg, type);

lsAllIPC

// 获取本地文件维护的key-value所有值
const res = await window.electron.lsAllIPC();

lsGetIPC

// 获取本地文件维护的key对应的value值
const res = await window.electron.lsGetIPC(key);

lsSetIPC

// 设置本地文件维护的key-value,value可以直接传对象,不用序列化
const res = await window.electron.lsSetIPC(key, value);

lsDelIPC

// 删除本地文件维护的key对应的value值
const res = await window.electron.lsDelIPC(key);

shellOpenUrlIPC

// 打开一个外部的url
const res = await window.electron.shellOpenUrlIPC(url);

shellShowPathIPC

// 打开本地的文件或者文件夹的位置
const res = await window.electron.shellShowPathIPC(path);

shortcutGlobalIPC

// 注册全局快捷键
const res = await window.electron.shortcutGlobalIPC(shortcutKey, shortcutCallbackName);

windowResizeIPC

// resize窗口大小
const res = await window.electron.windowResizeIPC(width, height);

main

封装一些主进程直接使用的方法

dialogOpenFolder

// 打开一个选择文件夹的dialog
const res = dialogOpenFolder(options);

logInit

// 在本地logs文件夹下生成一个date型的electron.log文件,并返回logger
const log = logInit();

ls

// 获取本地文件维护的key-value操作对象ls
const ls = ls();

shellOpenURL

// 打开一个外部的url
shellOpenURL(url);

shellShowPath

// 打开指定path的文件位置或者文件夹位置
shellShowPath(path);

shortcutReg

// 注册全局快捷键
shortcutReg(shortcutKey, shortcutCallback);

shortcutUnReg

// 注销全局快捷键
shortcutUnReg(shortcutKey);