Giter VIP home page Giter VIP logo

electron-toolkit's People

Contributors

alex8088 avatar psyirius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

electron-toolkit's Issues

共建electron-toolkit

Clear and concise description of the problem

我开发了一个适用于electron主进程的IOC 服务治理管理小工具,想发布在@electron-toolkit这个npm 组织下,不知道是否可以,这个是我的代码仓库:https://github.com/heychenfq/electron-toolkit
不知道怎么联系您,只能在仓库里提交issue了。

Suggested solution

not yet

Alternative

No response

Additional context

No response

Validations

ipcRenderer.postMessage should throw error when contextIsolated is enabled

Describe the bug

It wasted me hours figuring out why ipcRenderer.postMessage has no effect at all. 😂
Then I read the source code and found out if contextIsolated is enabled, the function just returns silently, which I believe is a bad practice.

postMessage(channel, message, transfer) {

Electron-Toolkit Version

2.0.0

Electron Version

25.6.0

Validations

CommandOrControl + Shift + R still works on production when using optimizer from @electron-toolkit/utils

Describe the bug

I use optimzer from @electron-toolkit/utils

It only ignores CommandOrControl + R, but when I press CommandOrControl + Shift + R it still reloads the page.

  // Default open or close DevTools by F12 in development
  // and ignore CommandOrControl + R in production.
  // see https://github.com/alex8088/electron-toolkit/tree/master/packages/utils
  app.on('browser-window-created', (_, window) => {
    optimizer.watchWindowShortcuts(window)
  })

How can I avoid CommandOrControl + Shift + R?

Electron-Toolkit Version

^2.0.1

Electron Version

27.0.1

Validations

ipcRenderer.removeListener不生效

Describe the bug

主进程:
setInterval(() => {
mainWindow.webContents.send("sendMessage", {id: 1, type: 4})
}, 5000);
渲染进程,vue组件
onMounted(()=>{
window.electron.ipcRenderer.on('sendMessage',getMessage)
})
onBeforeUnmount(()=>{
window.electron.ipcRenderer.removeListener('sendMessage',getMessage)
})
const getMessage=(val,message)=>{
console.log(val);
console.log(message);
}
组件销毁后,依旧能接收消息并在控制台打印,频繁创建销毁该组件,打印次数会累加

Electron-Toolkit Version

3.0.0

Electron Version

28.2.0

Validations

escToCloseWindow is Not work

Describe the bug

in function optimizer.watchWindowShortcuts.
2nd parameter's property escToCloseWindow is Not work.

the code just read window.close property, but not run it.

in code https://github.com/alex8088/electron-toolkit/blob/master/packages/utils/src/optimizer.ts#L68

 if (escToCloseWindow) {
          if (input.code === 'Escape' && input.key !== 'Process') {
            window.close    // <-- HERE!
            event.preventDefault()
          }
        }

Electron-Toolkit Version

latest

Electron Version

any

Validations

Leaking IPC to the renderer process is unsafe

Clear and concise description of the problem

According to the Electron documentation, @electron-toolkit/preload is unsafe as it provides the renderer process the ability to send arbitrary IPC messages.

Suggested solution

This problem isn't easy to solve without completely deprecating preload, seeing as it is designed to facilitate this practice. I believe it would be best to deprecate. If one wants to leak IPC, then they should disable context isolation, since context isolation is only designed around providing application API methods to the renderer process, not Electron API methods.

Alternative

No response

Additional context

No response

Validations

Undefined Electron API's

Describe the bug

Why is there only 3 electron api's available with import { electronAPI } from '@electron-toolkit/preload' ?
process, ipcRenderer, webFrame.
Example : I want to use the api for app to get the data path app.getPath('appData') .
Importing app in ../preload/index.ts import { app, contextBridge } from 'electron' shows app as undefined.
Now how am i supposed to get access to those other electron api's ?

Electron-Toolkit Version

3.0.0

Electron Version

28.2.0

Validations

Full working example of preload and ipcHelper with communication

Clear and concise description of the problem

I have converted an existing application from vue-cli to vite and have tried using electron-vite and toolkit but I am having an issue with the preload and ipcHelper.

I am getting the following error which seems to be from electron loading.

image

Suggested solution

Create a full working with preload and ipc communication like electron-vite-boilerplate.

Alternative

No response

Additional context

No response

Validations

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.