Electron JavaScript Uncaught TypeError:无法读取未定义的属性"on" [英] Electron JavaScript Uncaught TypeError: Cannot read property 'on' of undefined

查看:66
本文介绍了Electron JavaScript Uncaught TypeError:无法读取未定义的属性"on"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我是Electron开发的新手,我也不知道为什么会不断出错.

Hey I'm new to developing in Electron and I have no idea why I keep getting an error.

该应用在前几行中声明了

the app is declared in the first couple of lines

const electron = require('electron')
const app = electron.app
const BrowserWindow = electron.BrowserWindow

app.on('ready', createWindow)

app.on('window-all-closed', function () {

if (process.platform !== 'darwin') {
  app.quit()
}
})

app.on('activate', function () {

if (mainWindow === null) {
    createWindow()
  }
  })

预先感谢.

推荐答案

我知道我犯的错误是什么,我在index.html文件中添加了这一行.

I know what the mistake I was making was, I added this line in my index.html file.

<script type="text/javascript" src="main.js">  </script>

这会导致错误.

这篇关于Electron JavaScript Uncaught TypeError:无法读取未定义的属性"on"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆