Appendix. Code samples from Fire Sale and Clipmaster 9000

Fire Sale is an only slightly clever play on price markdowns—because it’s a Markdown editor after all. Clipmaster 9000 is a simple UI for the Clipmaster application.

Code from the end of chapter 6

Listing 1. Fire Sale’s main process: ./app/main.js
const { app, BrowserWindow, dialog } = require('electron'); const fs = require('fs'); const windows = new Set(); const openFiles = new Map(); app.on('ready', () => { createWindow(); }); app.on('window-all-closed', () => { if (process.platform === 'darwin') { return false; } }); app.on('activate', (event, hasVisibleWindows) => { if (!hasVisibleWindows) { createWindow(); } }); const createWindow = exports.createWindow = () => { let x, y; const ...

Get Electron in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.