草庐IT

Electron-store

全部标签

javascript - 在 Electron 上显示和隐藏主窗口

我不想退出应用程序,而是想在单击系统关闭按钮时隐藏主窗口,并在单击或激活应用程序时显示主窗口。我正在使用以下代码在我的Electron应用程序上执行此操作:'usestrict'import{app,BrowserWindow}from'electron'letmainWindowconstwinURL=process.env.NODE_ENV==='development'?`http://localhost:${require('../../../config').port}`:`file://${__dirname}/index.html`functioncreateWindow

javascript - 仅在关闭时隐藏窗口 [Electron]

我试图隐藏我的主窗口,这样我以后就不用再加载了。我得到以下代码:functioncreateWindow(){//Createthebrowserwindow.win=newBrowserWindow({width:800,height:600})//Emittedwhenthewindowisclosed.win.on('closed',(event)=>{//win=nullconsole.log(event);event.preventDefault();win.hide();})}所以这对我不起作用,当我关闭窗口时我收到此错误消息:有人可以帮助我吗?第37行是win.hide(

javascript - 作为 Vue 插件的一部分将 Mutations 添加到 Vuex store

我正在创建一个小型Vue插件,允许用户从任何组件中添加“页面通知”。我已经成功地实现了类似的东西:this.$notifications.add("一条消息");而且有效!但是我必须注册我的插件所需的突变和操作,作为为我的应用程序设置其余商店的文件的一部分:exportdefaultnewVuex.Store({...})有没有办法从我的插件中向我的商店添加操作和变更?目前看起来像这样:importvuexfrom'./../store';constMyPlugin={install(Vue,options){//4.addaninstancemethodVue.prototype.$

javascript - 如何在 Electron.Atom\WebPack 应用程序中使用 FS 模块?

我需要使用FS模块(fs.writeFile)在文件中写入一些数据。我的堆栈是webpack+react+redux+electron。第一个问题是:无法解析模块“fs”。我试着用target:"node",---node:{global:true,fs:"empty",}---resolve:{root:path.join(__dirname),fallback:path.join(__dirname,'node_modules'),modulesDirectories:['node_modules'],extensions:['','.json','.js','.jsx','.sc

javascript - ember-data - store.find ('model' ) 总是查询服务器

详细信息:ember-data-1.0.0.beta.3和默认的RESTAdapter我可能误解了store.find()方法的工作原理,但是,据我了解,如果我要查询的记录已经存在于商店:varIndexRoute=Em.Route.extend({model:function(){returnthis.store.find('link');},});来自DS.Store.find()的emberjs.com文档:Thefindmethodwillalwaysreturnapromisethatwillberesolvedwiththerecord.Iftherecordwasalre

javascript - 如何使用 Electron 显示打开的文件 native 对话框?

我正在尝试向我的Electron应用程序添加功能,允许用户在应用程序中打开文件,特别是纯文本文件。查看Electron文档后,我找到了this页。我将此代码添加到我的app.js文件中,我在我的index.html中链接了该文件。varfs=require('fs');vardialog=require('electron');$openFile=$('#openBtn');$editor=$('#editor');$openFile.click(function(){dialog.showOpenDialog(function(fileNames){if(fileNames===un

javascript - 如何在不使用 -webkit-app-region 的情况下在 Electron 中移动无框窗口

我一直试图在false上移动一个无框窗口,但现在我想通过拖动一个元素(标题栏)来移动整个窗口,我试过-webkit-app-region:drag;但是好像不行,我也试过https://www.npmjs.com/package/electron-drag但它也不起作用。 最佳答案 由于您的窗口是无框的,因此您可以使用属性-webkit-app-region,即使您的IDE说它不是,它仍然有效。出于用户体验考虑,您应该禁止文本选择并在标题栏内拖动按钮。.titlebar{-webkit-user-select:none;-webki

javascript - 'console.log' 在测试 Electron 应用程序时在 Webstorm 中不起作用

在Webstorm(Windows7)的“正常”Node应用程序中,我可以使用console.log写入Webstorm的控制台窗口。一旦我使用Electron创建桌面应用程序,控制台输出就不再显示在Webstorm控制台窗口中,尽管我使用相同的Node命令“C:\ProgramFiles\nodejs\node.exe”。主要区别在于,在运行配置中,我必须使用Node参数'C:\Users\Username\AppData\Roaming\npm\node_modules\electron-prebuilt\cli.js'来获得正确的Electron入口点。当我直接从Windows控

javascript - 如何隐藏使用 Electron 构建的 nodeJS 解决方案的源代码(asar 文件)?

关闭。这个问题需要更多focused.它目前不接受答案。想改进这个问题吗?更新问题,使其只关注一个问题editingthispost.关闭6年前。Improvethisquestion我寻找隐藏使用Electron构建的解决方案代码的最佳方法。有什么想法吗?用具有asar文件的Electron构建解决方案是不够的。我真的需要隐藏代码,这样它应该不容易检索。

javascript - Electron 拦截文件 :///protocol to read inside zip files

我想用Electron阅读内部的zip文件,就好像它们是文件夹一样,比如/myfolder/myarchive.zip/picture.jpg。为此,我正在考虑拦截文件协议(protocol)protocol.interceptFileProtocol('file',(request,callback)=>{if(insideZipArchive){//respondwithzipfilecontents}else{//defaultBehavior}},(error)=>{if(error)console.error('Failedtoregisterprotocol')})如何调用