Browse Source

Updated files

ca333-dev
Satinder Grewal 8 years ago
parent
commit
c234f7971f
  1. 9
      .gitignore
  2. 3
      EasyDEX-GUI/README
  3. BIN
      assets/iguana/iguana
  4. BIN
      assets/iguana/iguanaLinux
  5. 10
      assets/js/iguana.js
  6. 1
      assets/js/startup.js
  7. 18
      index.html
  8. 80
      main.js
  9. 24
      package.json

9
.gitignore

@ -35,3 +35,12 @@ jspm_packages
# Optional REPL history # Optional REPL history
.node_repl_history .node_repl_history
node_modules
tmp
help
debug.log
genesis
confs
DB
coins

3
EasyDEX-GUI/README

@ -0,0 +1,3 @@
Please clone EasyDEX-GUI from github repo here.
git clone https://github.com/SuperNETorg/EasyDEX-GUI.git

BIN
assets/iguana/iguana

Binary file not shown.

BIN
assets/iguana/iguanaLinux

Binary file not shown.

10
assets/js/iguana.js

@ -0,0 +1,10 @@
//SuperNET iguana app launcher
//var exec = require('child_process').exec
//exec does not return obj with stream but instead the whole buffer output from proc
//spawn returns objects with stderr and out streams
//for question contact ca333@keemail.me
const spawn = require('child_process').spawn;
var iguana = path.join(__dirname, '/assets/iguana/iguana');
//var os = require('os');

1
assets/js/startup.js

@ -0,0 +1 @@
//startup separator for superNET iguana

18
index.html

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>iguanaElectronApp</title>
</head>
<body>
<h3>some version information:</h3>
node.js <script>document.write(process.versions.node)</script>,
chromium <script>document.write(process.versions.chrome)</script>,
electron <script>document.write(process.versions.electron)</script>.
</body>
<script>
//bind other code refs
//require('./xxx.js')
</script>
</html>

80
main.js

@ -0,0 +1,80 @@
//main proc for EasyDEX GUI
//this app spawns iguana in background in nontech-mode
const electron = require('electron')
const app = electron.app
const BrowserWindow = electron.BrowserWindow
const path = require('path')
const url = require('url')
const os = require('os')
//require('./assets/js/iguana.js'); //below code shall be separated into asset js for public version
const spawn = require('child_process').spawn;
var iguanaOSX = path.join(__dirname, '/assets/iguana/iguana');
var iguanaLinux = path.join(__dirname, '/assets/iguana/iguanaLinux');
var iguanaWin = path.join(__dirname, '/assets/iguana/iguana');
let mainWindow
function createWindow () {
// initialise window
mainWindow = new BrowserWindow({width: 800, height: 600})
// load our index.html (i.e. easyDEX GUI)
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'EasyDEX-GUI/index.html'),
protocol: 'file:',
slashes: true
}))
// DEVTOOLS - only for dev purposes - ca333
mainWindow.webContents.openDevTools()
// if window closed we kill iguana proc
mainWindow.on('closed', function () {
ig.kill();
// our app does not have multiwindow - so we dereference the window object instead of
// putting them into an window_arr
mainWindow = null
})
//ca333 todo - add os detector to use correct binary - so we can use the same bundle on ALL OS platforms
//if (os.platform() === 'win32') {
//ex(iguanaWin) //specify binary in startup
//}
if (os.platform() === 'linux') {
ig = spawn(iguanaLinux);
}
if (os.platform() === 'darwin') {
ig = spawn(iguanaOSX);
}
//}if (os.platform() === 'freeBSD') {
//ex(iguanaFreeBSD)
//}
//ca333 - could also specifiy via os.arch (x86, x64, etc. ) in startup and pass via param to main proc
ig.stderr.on( 'error: ', data => {
console.log( `stderr: ${data}` );
});
}
app.on('ready', createWindow)
app.on('window-all-closed', function () {
ig.kill();
// in osx apps stay active in menu bar until explictly closed or quitted by CMD Q
// so we do not kill the app --> for the case user clicks again on the iguana icon
// we open just a new window and respawn iguana proc
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
if (mainWindow === null) {
createWindow()
}
})

24
package.json

@ -0,0 +1,24 @@
{
"name": "iguana_electron",
"version": "1.0.0",
"description": "Electron iguana app launcher",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"repository": "https://github.com/ca333/iguana_electron",
"keywords": [
"iguana",
"superNET",
"komodo"
],
"author": "ca333, grewalsatinder",
"license": "MIT",
"devDependencies": {
"electron": "^1.4.1"
},
"dependencies": {
"jquery": "^2.2.4",
"toastr": "^2.1.2"
}
}
Loading…
Cancel
Save