forked from aditya-sridhar/simple-desktop-app-electronjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 80b943c
Showing
7 changed files
with
211 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"env": { | ||
"development": { | ||
"application/javascript": { | ||
"presets": [ | ||
[ | ||
"env", | ||
{ | ||
"targets": { | ||
"electron": "3.0" | ||
} | ||
} | ||
], | ||
"react" | ||
], | ||
"plugins": [ | ||
"transform-async-to-generator" | ||
], | ||
"sourceMaps": "inline" | ||
} | ||
}, | ||
"production": { | ||
"application/javascript": { | ||
"presets": [ | ||
[ | ||
"env", | ||
{ | ||
"targets": { | ||
"electron": "3.0" | ||
} | ||
} | ||
], | ||
"react" | ||
], | ||
"plugins": [ | ||
"transform-async-to-generator" | ||
], | ||
"sourceMaps": "none" | ||
} | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "eslint-config-airbnb", | ||
"rules": { | ||
"import/extensions": 0, | ||
"import/no-extraneous-dependencies": 0, | ||
"import/no-unresolved": [2, { "ignore": ["electron"] }], | ||
"linebreak-style": 0 | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
out | ||
package-lock.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"name": "simple-desktop-app-electronjs", | ||
"productName": "simple-desktop-app-electronjs", | ||
"version": "1.0.0", | ||
"description": "My Electron application description", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"start": "electron-forge start", | ||
"package": "electron-forge package", | ||
"make": "electron-forge make", | ||
"publish": "electron-forge publish", | ||
"lint": "eslint src --color" | ||
}, | ||
"keywords": [], | ||
"author": "Aditya", | ||
"license": "MIT", | ||
"config": { | ||
"forge": { | ||
"make_targets": { | ||
"win32": [ | ||
"squirrel" | ||
], | ||
"darwin": [ | ||
"zip" | ||
], | ||
"linux": [ | ||
"deb", | ||
"rpm" | ||
] | ||
}, | ||
"electronPackagerConfig": { | ||
"packageManager": "npm" | ||
}, | ||
"electronWinstallerConfig": { | ||
"name": "simple_desktop_app_electronjs" | ||
}, | ||
"electronInstallerDebian": {}, | ||
"electronInstallerRedhat": {}, | ||
"github_repository": { | ||
"owner": "", | ||
"name": "" | ||
}, | ||
"windowsStoreConfig": { | ||
"packageName": "", | ||
"name": "simpledesktopappelectronjs" | ||
} | ||
} | ||
}, | ||
"dependencies": { | ||
"bootstrap": "^4.1.3", | ||
"electron-compile": "^6.4.3", | ||
"electron-squirrel-startup": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"babel-plugin-transform-async-to-generator": "^6.24.1", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-preset-react": "^6.24.1", | ||
"electron-forge": "^5.2.3", | ||
"electron-prebuilt-compile": "3.0.10", | ||
"eslint": "^3.19.0", | ||
"eslint-config-airbnb": "^15.1.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-jsx-a11y": "^5.1.1", | ||
"eslint-plugin-react": "^7.11.1" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Temperature Converter</title> | ||
<link rel="stylesheet" type="text/css" href="../node_modules/bootstrap/dist/css/bootstrap.min.css"> | ||
|
||
</head> | ||
<body> | ||
<h1>Temperature Converter</h1> | ||
<div class="form-group col-md-3"> | ||
<label for="usr">Celcius:</label> | ||
<input type="text" class="form-control" id="celcius" onkeyup="celciusToFahrenheit()"> | ||
</div> | ||
<div class="form-group col-md-3"> | ||
<label for="pwd">Fahrenheit:</label> | ||
<input type="text" class="form-control" id="fahrenheit" onkeyup="fahrenheitToCelcius()"> | ||
</div> | ||
<script src='./renderer.js'></script> | ||
</body> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { app, BrowserWindow } from 'electron'; | ||
|
||
// Handle creating/removing shortcuts on Windows when installing/uninstalling. | ||
if (require('electron-squirrel-startup')) { // eslint-disable-line global-require | ||
app.quit(); | ||
} | ||
|
||
// 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. | ||
let mainWindow; | ||
|
||
const createWindow = () => { | ||
// Create the browser window. | ||
mainWindow = new BrowserWindow({ | ||
width: 800, | ||
height: 600, | ||
}); | ||
|
||
// and load the index.html of the app. | ||
mainWindow.loadURL(`file://${__dirname}/index.html`); | ||
|
||
// Open the DevTools. | ||
//mainWindow.webContents.openDevTools(); | ||
|
||
// Emitted when the window is closed. | ||
mainWindow.on('closed', () => { | ||
// 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; | ||
}); | ||
}; | ||
|
||
// 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.on('ready', createWindow); | ||
|
||
// Quit when all windows are closed. | ||
app.on('window-all-closed', () => { | ||
// 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(); | ||
} | ||
}); | ||
|
||
app.on('activate', () => { | ||
// On OS X 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 (mainWindow === null) { | ||
createWindow(); | ||
} | ||
}); | ||
|
||
// In this file you can include the rest of your app's specific main process | ||
// code. You can also put them in separate files and import them here. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function celciusToFahrenheit(){ | ||
let celcius = document.getElementById('celcius').value; | ||
let fahrenheit = (celcius* 9/5) + 32; | ||
document.getElementById('fahrenheit').value = fahrenheit; | ||
|
||
} | ||
|
||
function fahrenheitToCelcius(){ | ||
let fahrenheit = document.getElementById('fahrenheit').value; | ||
let celcius = (fahrenheit - 32) * 5/9 | ||
document.getElementById('celcius').value = celcius; | ||
} |