1 Star 0 Fork 179

恋风 / lucky-lottery

forked from dungang / lucky-lottery 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.js 1.50 KB
一键复制 编辑 原始数据 按行查看 历史
dungang 提交于 2017-01-05 15:38 . init
const {
app,
BrowserWindow,
globalShortcut,
ipcMain,
} = require('electron')
let mainWindow
function createWindow () {
mainWindow = new BrowserWindow({
frame: false,
resizable: false,
fullscreen:true
});
mainWindow.loadURL(`file://${__dirname}/index.html`)
mainWindow.setAutoHideMenuBar(true)
mainWindow.on('closed', () => {
mainWindow = null
})
globalShortcut.unregisterAll();
//开始抽奖
globalShortcut.register('alt+s',()=>{
mainWindow.webContents.send('global-shortcut','start');
});
//停止抽奖
globalShortcut.register('alt+c',()=>{
mainWindow.webContents.send('global-shortcut','stop');
});
//切换到下一个奖项
globalShortcut.register('alt+n',()=>{
mainWindow.webContents.send('global-shortcut','next');
});
//截屏
globalShortcut.register('alt+x',()=>{
mainWindow.webContents.send('global-shortcut','capture');
});
//关闭/打开背景音乐
globalShortcut.register('alt+v',()=>{
mainWindow.webContents.send('global-shortcut','novoice');
});
//退出
globalShortcut.register('ctrl+q',()=>{
app.quit();
});
//调试
globalShortcut.register('ctrl+i',function(){
mainWindow.webContents.openDevTools();
});
}
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (mainWindow === null) {
createWindow()
}
})
JavaScript
1
https://gitee.com/lianfeng/lucky-lottery.git
git@gitee.com:lianfeng/lucky-lottery.git
lianfeng
lucky-lottery
lucky-lottery
master

搜索帮助