Skip to content

Commit

Permalink
add example
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Dec 25, 2015
1 parent b75ce74 commit defa6b3
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .npm-ignore
@@ -0,0 +1,4 @@
/typings
/.git
/example
npm-debug.log
Binary file added example/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions example/index.html
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Example</title>
</head>
<body>
<div>Click 'About' item in 'Example' menu.</div>
</body>
</html>
34 changes: 34 additions & 0 deletions example/main.js
@@ -0,0 +1,34 @@
var electron = require('electron');
var app = electron.app;
var Menu = electron.Menu;
var BrowserWindow = electron.BrowserWindow;
var openAboutWindow = require('..').default;
var join = require('path').join;

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

app.once('ready', function() {
var w = new BrowserWindow();
w.once('closed', function() { w = null; });
w.loadURL('file://' + join(__dirname, 'index.html'));
w.webContents.openDevTools({detach: true});

const menu = Menu.buildFromTemplate([
{
label: 'Example',
submenu: [
{
label: 'About',
click: function() {
openAboutWindow(
join(__dirname, 'icon.png'),
'Copyright (c) 2015 rhysd',
'https://github.com/rhysd/about-window'
);
}
}
]
}
]);
Menu.setApplicationMenu(menu);
});
9 changes: 9 additions & 0 deletions example/package.json
@@ -0,0 +1,9 @@
{
"name": "about-window-module-example-app",
"productName": "Example",
"version": "0.0.1",
"main": "main.js",
"scripts": {
"app": "../../node_modules/.bin/electron ."
}
}

0 comments on commit defa6b3

Please sign in to comment.