Commit beefaefe authored by Rios, Raul's avatar Rios, Raul
Browse files

Project so far

parent 4cf747d1
Loading
Loading
Loading
Loading

app/app.html

0 → 100755
+708 −0

File added.

Preview size limit exceeded, changes collapsed.

app/app.js

0 → 100755
+25 −0
Original line number Diff line number Diff line
// Here is the starting point for your application code.
// All stuff below is just to show you how it works. You can delete all of it.

// Use new ES6 modules syntax for everything.
import os from 'os'; // native node.js module
import { remote } from 'electron'; // native electron module
import jetpack from 'fs-jetpack'; // module loaded from npm
import env from './env';

console.log('Loaded environment variables:', env);

var app = remote.app;
var appDir = jetpack.cwd(app.getAppPath());
var dialog = remote.dialog;
module.exports = dialog;

// Holy crap! This is browser window with HTML and stuff, but I can read
// here files like it is node.js! Welcome to Electron world :)
console.log('The author of this app is:', appDir.read('package.json', 'json').author);

// document.addEventListener('DOMContentLoaded', function () {
//     //document.getElementById('greet').innerHTML = greet();
//     //document.getElementById('platform-info').innerHTML = os.platform();
//     //document.getElementById('env-name').innerHTML = env.name;
// });

app/background.js

0 → 100755
+48 −0
Original line number Diff line number Diff line
// This is main process of Electron, started as first thing when your
// app starts. This script is running through entire life of your application.
// It doesn't have any windows which you can see on screen, but we can open
// window from here.
import { app, Menu } from 'electron';
import { devMenuTemplate } from './helpers/dev_menu_template';
//import { fileMenu,axesMenu,dataMenu,measureMenu,helpMenu } from './helpers/appMenu';
import createWindow from './helpers/window';




// Special module holding environment variables which you declared
// in config/env_xxx.json file.
import env from './env';

var mainWindow = null;


var setApplicationMenu = function () {
    var menus = [fileMenu,axesMenu,dataMenu,measureMenu,helpMenu];
    if (env.name !== 'production') {
        menus.push(devMenuTemplate);
    }
    Menu.setApplicationMenu(Menu.buildFromTemplate(menus));
};

app.on('ready', function () {

    //setApplicationMenu();

    var mainWindow = createWindow('main', {
        width: 1000,
        height: 600
    });

    console.log(__dirname);
    mainWindow.loadURL('file://' + __dirname + '/app.html');

    if (env.name !== 'production') {
        mainWindow.openDevTools();
    }

});

app.on('window-all-closed', function () {
    app.quit();
});

app/env.js

0 → 100755
+8 −0
Original line number Diff line number Diff line
// Simple wrapper exposing environment variables to rest of the code.

import jetpack from 'fs-jetpack';

// The variables have been written to `env.json` by the build process.
var env = jetpack.cwd(__dirname).read('env.json', 'json');

export default env;
+14 −0
Original line number Diff line number Diff line
// Tests here are for easier maintenance of this boilerplate.
// Feel free to delete this file in your own project.

import { expect } from 'chai';
import env from '../env';

describe("boilerplate tests", function () {

    it("environment variables should be on their place", function () {
        expect(env.name).to.equal('test');
        expect(env.description).to.equal('Add here any environment specific stuff you like.');
    });

});
Loading