From abb83374b72e8d8ac824bb59ad80697ac2136b0d Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Fri, 12 Jan 2018 21:09:26 +1300 Subject: [PATCH] Started to implement menus --- main.js | 19 +++++++- sources/index.html | 3 +- sources/scripts/controller.js | 41 ++++++++++++++++++ sources/scripts/dotgrid.js | 81 +++++++++++++++++++++-------------- 4 files changed, 108 insertions(+), 36 deletions(-) create mode 100644 sources/scripts/controller.js diff --git a/main.js b/main.js index ab8e3dd..3994ddc 100644 --- a/main.js +++ b/main.js @@ -5,12 +5,20 @@ const shell = require('electron').shell let win +app.inspect = function() +{ + win.webContents.openDevTools(); +} + +app.inject_menu = function(m) +{ + Menu.setApplicationMenu(Menu.buildFromTemplate(m)); +} + app.on('ready', () => { win = new BrowserWindow({width: 400, height: 420, minWidth: 400, minHeight: 400, backgroundColor:"#000", frame:false, autoHideMenuBar: true, icon: __dirname + '/icon.ico'}) - win.loadURL(`file://${__dirname}/sources/index.html`) - let is_shown = true; Menu.setApplicationMenu(Menu.buildFromTemplate([ @@ -28,6 +36,12 @@ app.on('ready', () => } ])); + win.loadURL(`file://${__dirname}/sources/index.html`) + + win.webContents.on('did-finish-load', () => { + win.webContents.send('controller-access', "hello"); + }) + win.on('closed', () => { win = null app.quit() @@ -38,6 +52,7 @@ app.on('ready', () => }) win.on('show',function() { + var something = {name:"fuck"} is_shown = true; }) }) diff --git a/sources/index.html b/sources/index.html index b8a4235..bb640c8 100644 --- a/sources/index.html +++ b/sources/index.html @@ -11,6 +11,7 @@ + @@ -22,7 +23,7 @@