Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

electron-captureview

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-captureview

'a electron screen capture'

  • 1.0.12
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

安装

npm install electron-captureview

用法

  1. 主进程中初始化截图
import CaptureView from 'electron-captureview'
// ... 跟主窗口一起创建
const capture = new CaptureView({
    devTools: false,
    Mosaic: false,
    Text: false,
    onShow: () => {
      console.log('启动截图')
    },
    onClose: () => {
      console.log('结束截图')
    },
    onShowByShortCut: () => {
      console.log('快捷键启动截图')
    }
  })
// capture.updateShortCutKey('shift+option+c')
// capture.setMultiScreen(false)

2.渲染进程中调用截图对象

const { remote } = require('electron')
const captureview = remote.getGlobal('captureView')
captureview.open()
已知问题
  • ubuntu18的截图在全屏窗口下左边的dock不会被覆盖,导致不能全屏覆盖
  • ubuntu18的扩展屏幕截图会将2个屏幕的信息合在一张图上, 扩展屏截图尚不支持
  • 无法像qq,微信等,实现应用窗口的选择

选项

名称类型说明默认值
multiScreenboolean是否开启多显示屏截图false
globalShortCutstring快捷键'shift+option+A'
devToolsboolen打开或关闭截图devtools工具false
fileprefixstring保存的图片文件名字前缀, 默认: fileprefix+yyyymmddhhmmss(时间格式)''
onClose()=>void关闭截图的回调函数
onShow()=>void打开截图的回调函数
onShowByShortCut()=>void快捷键打开截图的回调函数
Mosaicboolean打开马赛克功能false
Textboolean打开文字编辑功能false
curveboolean打开画笔编辑功能false

方法

名称说明参数返回值
useCapture初始化截图--
open打开截图功能
close关闭截图功能
updateShortCutKey更新快捷键key:string-
setMultiScreen设置扩展屏flag:boolean

tips: 考虑性能原因, 多显示屏截图需要多开一个启动窗口,容易消耗性能,所以默认单屏幕截屏

展示

demo.gif

支持

  • Mac完美支持多显示器
  • 截图存入剪贴板
  • 截图保存本地文件
  • 画笔
  • 画圆
  • 画方框
  • 画箭头
  • 马赛克
  • 文字
  • 撤销
  • 选框大小调整
  • 选框移动
  • 快捷键打开,Esc退出

TODO

  • PC端的截图待测试

FAQs

Package last updated on 17 Nov 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc