Merge pull request #14 from lneir/dmg-img-update

update dmg image and docs
This commit is contained in:
Lynn 2017-02-13 16:33:38 -08:00 committed by GitHub
commit c36328eb4d
6 changed files with 25 additions and 11 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

BIN
build/background.tiff Normal file

Binary file not shown.

View File

@ -1,5 +1,5 @@
// script run before others and still has access to node integration, even // script run before others and still has access to node integration, even
// when turned off - also us to leak only what want into window object. // when turned off - allows us to leak only what want into window object.
// see: http://electron.atom.io/docs/api/browser-window/ // see: http://electron.atom.io/docs/api/browser-window/
// //
// to leak some node module into: // to leak some node module into:
@ -15,10 +15,9 @@ const { ipcRenderer } = require('electron');
// hold ref so doesn't get GC'ed // hold ref so doesn't get GC'ed
const local = { const local = {
ipcRenderer: ipcRenderer ipcRenderer: ipcRenderer
} };
// JS can detect if in wrapper mode by looking for window.SYM_API obj // API exposed by Symphony to a child window:
// API exposes by Symphony to a child window:
window.SYM_API = { window.SYM_API = {
}; };

View File

@ -1,5 +1,5 @@
// script run before others and still has access to node integration, even // script run before others and still has access to node integration, even
// when turned off - also us to leak only what want into window object. // when turned off - allows us to leak only what want into window object.
// see: http://electron.atom.io/docs/api/browser-window/ // see: http://electron.atom.io/docs/api/browser-window/
// //
// to leak some node module into: // to leak some node module into:
@ -15,10 +15,9 @@ const { ipcRenderer } = require('electron');
// hold ref so doesn't get GC'ed // hold ref so doesn't get GC'ed
const local = { const local = {
ipcRenderer: ipcRenderer ipcRenderer: ipcRenderer
} };
// JS can detect if in container mode by looking for window.SYM_API obj // API exposed by Symphony to main window:
// API exposes by Symphony to main window:
window.SYM_API = { window.SYM_API = {
openWindow: function(url) { openWindow: function(url) {
local.ipcRenderer.send('symphony-msg', { local.ipcRenderer.send('symphony-msg', {

View File

@ -76,6 +76,10 @@ function createMainWindow () {
}); });
} }
/**
* Generate a key (guid).
* @return {string} guid
*/
function getWindowKey() { function getWindowKey() {
// generate guid: // generate guid:
// http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript // http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
@ -113,6 +117,10 @@ function isValidWindow(event) {
return false; return false;
} }
/**
* Handle ipc messages from renderers. Only messages from windows we have
* created are allowed.
*/
electron.ipcMain.on('symphony-msg', (event, arg) => { electron.ipcMain.on('symphony-msg', (event, arg) => {
if (!isValidWindow(event)) { if (!isValidWindow(event)) {
console.log('invalid window try to perform action, ignoring action.'); console.log('invalid window try to perform action, ignoring action.');
@ -143,9 +151,11 @@ electron.ipcMain.on('symphony-msg', (event, arg) => {
} }
}); });
// This method will be called when Electron has finished /**
// initialization and is ready to create browser windows. * This method will be called when Electron has finished
// Some APIs can only be used after this event occurs. * initialization and is ready to create browser windows.
* Some APIs can only be used after this event occurs.
*/
app.on('ready', function() { app.on('ready', function() {
createMainWindow(); createMainWindow();
}); });

View File

@ -19,6 +19,12 @@
"target": "dmg", "target": "dmg",
"category": "public.app-category.business" "category": "public.app-category.business"
}, },
"dmg": {
"contents": [
{ "x": 140, "y": 184 },
{ "x": 412, "y": 184, "type": "link", "path": "/Applications" }
]
},
"win": { "win": {
"target": "squirrel" "target": "squirrel"
} }