electronメッセージアラームアイコンのシンチレーション効果が実現されます.


// Modules to control application life and create native browser window
const {
     app, BrowserWindow, globalShortcut, ipcMain, ipcRenderer, Menu, Tray} = require('electron')
const path = require('path')
let mainWindow = null;
let appIcon = null;
	function createWindow() {
     
		mainWindow = new BrowserWindow({
     
			minWidth: 1200,
			minHeight: 750,
			resizable: true,
			icon: 'favicon.ico',
			skipTaskbar: false
		});
		//                  
		mainWindow.flashFrame(true);

		let appIcon = new Tray('favicon.ico');

		const contextMenu = Menu.buildFromTemplate([{
     
			label: '  ',
			click: function() {
     
				event.sender.send('tray-removed');
			}
		}, {
     
			type: 'separator'
		}, {
     
			label: 'Item1',
			type: 'radio'
		}, {
     
			type: 'separator'
		},{
     
			label: 'MenuItem2',
			type: 'checkbox',
			checked: true
		}]);

		// Make a change to the context menu
		contextMenu.items[2].checked = false;

		appIcon.setToolTip('      Electron   .');

		appIcon.setContextMenu(contextMenu);
		var count = 0;
		let interv = setInterval(function() {
     
			if (count++ % 2 == 0) {
     
				appIcon.setImage(path.join(__dirname, 'favicon.ico'));
			} else {
     
				appIcon.setImage(path.join(__dirname, 'logo_wikiwhite.png'));
			}
		}, 400);
		clearInterval(interv);
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.allowRendererProcessReuse = false;
app.disableHardwareAcceleration()
app.whenReady().then(createWindow)

// Quit when all windows are closed.
app.on('window-all-closed', function () {
     
	// On macOS 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()
})

app.on('activate', function () {
     
	// On macOS it's common to re-create a window in the app when the
	// dock icon is clicked and there are no other windows open.
	if (BrowserWindow.getAllWindows().length === 0) createWindow()
})