This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html lang='en'> | |
<head> | |
<meta charset='UTF-8'> | |
<meta name='viewport' content='width=device-width, initial-scale=1.0'> | |
</head> | |
<body style="background-color: #eee;"> | |
<div id='app'></div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import path from 'path'; | |
import fs from 'fs'; | |
// get application version from `static/version.txt` | |
export const getVersion = () => { | |
const versionFilePath = path.resolve( __static, 'version.txt' ); | |
return fs.readFileSync( versionFilePath, { | |
encoding: 'utf-8', | |
} ); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { app, BrowserWindow } from 'electron'; | |
import path from 'path'; | |
// local dependencies | |
import { getVersion } from 'common/util'; | |
// get environment type | |
const isDevelopment = process.env.NODE_ENV !== 'production'; | |
// open a window |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "My React App", | |
"main": { | |
"sourceDirectory": "app/main" | |
}, | |
"renderer": { | |
"sourceDirectory": "app/renderer", | |
"template": "app/renderer/index.html" | |
}, | |
"commonSourceDirectory": "app/common", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { ipcRenderer } = require( 'electron' ); | |
// copy file | |
window.copyFile = function ( event, itemId ) { | |
event.preventDefault(); | |
// get path of the file | |
const itemNode = document.getElementById( itemId ); | |
const filepath = itemNode.getAttribute( 'data-filepath' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dragDrop = require( 'drag-drop' ); | |
const { ipcRenderer } = require( 'electron' ); | |
// local dependencies | |
const dom = require( './dom' ); | |
/*****************************/ | |
// get list of files from the `main` process | |
ipcRenderer.invoke( 'app:get-files' ).then( ( files = [] ) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang='en'> | |
<head> | |
<meta charset='UTF-8'> | |
<meta name='viewport' content='width=device-width, initial-scale=1.0'> | |
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" /> | |
<title>Files Manager</title> | |
<!-- import fonts --> | |
<link rel="preconnect" href="https://fonts.gstatic.com"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Notification } = require( 'electron' ); | |
// display files added notification | |
exports.filesAdded = ( size ) => { | |
const notif = new Notification( { | |
title: 'Files added', | |
body: `${ size } file(s) has been successfully added.` | |
} ); | |
notif.show(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { ipcMain } = require( 'electron' ); | |
const path = require( 'path' ); | |
const fs = require( 'fs-extra' ); | |
const os = require( 'os' ); | |
const open = require( 'open' ); | |
const chokidar = require( 'chokidar' ); | |
// local dependencies | |
const notification = require( './notification' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { app, BrowserWindow, ipcMain, dialog } = require( 'electron' ); | |
const path = require( 'path' ); | |
// local dependencies | |
const io = require( './main/io' ); | |
`` | |
// open a window | |
const openWindow = () => { | |
const win = new BrowserWindow( { | |
width: 800, |