Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

electron sample question

'use strict';
const path = require('path');
const { app, BrowserWindow, Menu, globalShortcut} = require('electron');
const unhandled = require('electron-unhandled');
const debug = require('electron-debug');
const {is} = require('electron-util');

unhandled();
debug();
contextMenu();

// Note: Must match `build.appId` in package.json
app.setAppUserModelId('com.pixzeldigital.attrfidqrcode');

// Prevent window from being garbage collected
let mainWindow;

const createMainWindow = async () => {

    const win = new BrowserWindow({
        title: app.name,
        show: false,
        width: 1024,
        height: 768,
        frame: false
    });

    win.on('ready-to-show', () => {
        win.maximize();
        win.show();
    });

    win.on('closed', () => {
        // Dereference the window
        // For multiple windows store them in an array
        mainWindow = undefined;
    });

    await win.loadFile(path.join(__dirname, 'vue/dist/index.html'));

    return win;
};

// Prevent multiple instances of the app
if (!app.requestSingleInstanceLock()) {
    app.quit();
}

app.on('second-instance', () => {
    if (mainWindow) {
        if (mainWindow.isMinimized()) {
            mainWindow.restore();
        }

        mainWindow.show();
    }
});

app.on('window-all-closed', () => {
    if (!is.macos) {
        app.quit();
    }
});

app.on('activate', async () => {
    if (!mainWindow) {
        mainWindow = await createMainWindow();
    }
});

app.on('ready', () => {
    // Register a shortcut listener for Ctrl + Shift + I
    globalShortcut.register('Control+Shift+I', () => {
        // When the user presses Ctrl + Shift + I, this function will get called
        // You can modify this function to do other things, but if you just want
        // to disable the shortcut, you can just return false
        return false;
    });
});

(async () => {
    await app.whenReady();
    Menu.setApplicationMenu(null);
    mainWindow = await createMainWindow();
})();
Comment

PREVIOUS NEXT
Code Example
Javascript :: verificar radio selected 
Javascript :: force reload when back_forward is clicked 
Javascript :: mozilla observer onclick 
Javascript :: compile pdf with javascript 
Javascript :: scenery 
Javascript :: can i use pipe in switch statement javascript 
Javascript :: change span value according to textfierld value in jquery 
Javascript :: cors error in post request resolved 
Javascript :: how to add some thing in JS Array 
Javascript :: javascript bitset 
Javascript :: add if condition in map react 
Javascript :: check if a package is compatible with node 14 
Javascript :: Event listener with single mouse click in extendscript 
Javascript :: javascript verbatim string 
Javascript :: javascript multiple enventListeners in one 
Javascript :: wrap three three set div in a single div 
Javascript :: constructor function javascript and creating an object from it 
Javascript :: execute powershell command from javascript 
Javascript :: JavaScript startsWith() example with Position parameter 
Javascript :: myModal 
Javascript :: silk carousel jquery 
Javascript :: react foreach loop 
Javascript :: how to send multiple values in event in javascript 
Javascript :: how to pass string in javascript function 
Javascript :: SharePoint Rest Api in Batch using PnP JS 
Javascript :: Serve JSON on a Specific Route 
Javascript :: Reactjs class exemple componentDidMount 
Javascript :: assignment of struct in solidity 
Javascript :: Zoho Creator Javascript Loop through more than 200 records 
Javascript :: how to cookie set in node js 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =