From 8a35aa08c43211125d8afb607a94165296dfb2f9 Mon Sep 17 00:00:00 2001 From: Lucifer Date: Fri, 13 Dec 2019 06:35:10 +0530 Subject: Started macOS Development Added main.js and index.html for macOS Native Kit development --- templates/mac/index.html | 12 ++++++++++++ templates/mac/main.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 templates/mac/index.html create mode 100644 templates/mac/main.js diff --git a/templates/mac/index.html b/templates/mac/index.html new file mode 100644 index 0000000..1357638 --- /dev/null +++ b/templates/mac/index.html @@ -0,0 +1,12 @@ + + + + + + + macOS Native Kit + + +

Native Kit macOS

+ + \ No newline at end of file diff --git a/templates/mac/main.js b/templates/mac/main.js new file mode 100644 index 0000000..7d7f099 --- /dev/null +++ b/templates/mac/main.js @@ -0,0 +1,45 @@ +// {app} Module to control application life. +// {BrowserWindow} Module to create native browser window. +const {app, BrowserWindow} = require('electron') + +// Keep a global reference of the window object, if you don't, the window will +// be closed automatically when the JavaScript object is garbage collected. +var mainWindow = null; + +// Quit when all windows are closed. +app.on('window-all-closed', function() { + // On OS X it is common for applications and their menu bar + // to stay active until the user quits explicitly with Cmd + Q + if (process.platform != 'darwin') { + app.quit(); + } +}); + +// This method will be called when Electron has finished +// initialization and is ready to create browser windows. +app.on('ready', function() { + // Create the browser window. + mainWindow = new BrowserWindow({ + width: 800, + height: 600, + minWidth: 500, + minHeight: 200, + acceptFirstMouse: true, + titleBarStyle: 'hidden', + frame: false + }); + + // and load the index.html of the app. + mainWindow.loadURL('file://' + __dirname + '/index.html'); + + // Open the DevTools. + //mainWindow.openDevTools(); + + // Emitted when the window is closed. + mainWindow.on('closed', function() { + // Dereference the window object, usually you would store windows + // in an array if your app supports multi windows, this is the time + // when you should delete the corresponding element. + mainWindow = null; + }); +}); \ No newline at end of file -- cgit v1.2.3