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

@quiteer/electronup

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@quiteer/electronup

基于electron ,

  • 0.0.1
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

@quiteer/electron-preload

基于electron , 提供预加载功能脚本

安装

npm i @quiteer/electron-preload
yarn add @quiteer/electron-preload
pnpm add @quiteer/electron-preload

使用

在主进程中引入预加载脚本

import preload from '@quiteer/electron-preload'

const win = new BrowserWindow({
  width: 800,
  height: 600,
  webPreferences: {
    sandbox: false,
    preload
  }
})

暴露的api

分别暴露了以下api , 具体使用方法可参照官方 api 文档使用

  • ipcRenderer

    • send
    • sendSync
    • invoke
    • on
    • once
    • removeAllListeners
  • clipboard

    • readText
    • writeText
    • readHTML
    • writeHTML
    • readImage
    • writeImage
    • readRTF
    • writeRTF
    • readBookmark
    • writeBookmark
    • readFindText
    • writeFindText
    • clear
    • availableFormats
    • has
    • read
    • readBuffer
    • writeBuffer
    • write
  • webFrame

    • setZoomFactor
    • getZoomFactor
    • setZoomLevel
    • getZoomLevel
    • insertText
    • executeJavaScript
    • executeJavaScriptInIsolatedWorld
    • setIsolatedWorldInfo
    • getResourceUsage
    • clearCache
    • getFrameForSelector
    • firstChild
    • nextSibling
    • opener
    • parent
    • routingId
    • top
  • nodejs 的 path 模块部分 api

    • basename
    • dirname
    • extname
    • join
    • parse
    • relative
    • resolve

渲染进程中使用

console.log('window.$ipc :>> ', window.$ipc)
console.log('window.$path :>> ', window.$path)
console.log('window.$clipboard :>> ', window.$clipboard)
console.log('window.$webFrame :>> ', window.$webFrame)
获取类型提示

全局类型声明

interface Window {
  $ipc: import('@quiteer/electron-preload').PreloadIpc
  $clipboard: import('@quiteer/electron-preload').PreLoadPath
  $webFrame: import('@quiteer/electron-preload').PreloadWebFrame
  $path: import('@quiteer/electron-preload').PreLoadPath
}

Keywords

FAQs

Package last updated on 22 Nov 2022

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