mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
updates as discussed
This commit is contained in:
parent
d885128900
commit
38fddea3d4
@ -31,7 +31,7 @@ require('crash-reporter').start();
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
// be closed automatically when the javascript object is GCed.
|
||||
var mainWindow: GitHubElectron.BrowserWindow = null;
|
||||
var mainWindow: Electron.BrowserWindow = null;
|
||||
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', () => {
|
||||
@ -72,6 +72,7 @@ app.on('ready', () => {
|
||||
mainWindow.webContents.addWorkSpace('/path/to/workspace');
|
||||
mainWindow.webContents.removeWorkSpace('/path/to/workspace');
|
||||
var opened: boolean = mainWindow.webContents.isDevToolsOpened()
|
||||
var focused = mainWindow.webContents.isDevToolsFocused();
|
||||
// Emitted when the window is closed.
|
||||
mainWindow.on('closed', () => {
|
||||
// Dereference the window object, usually you would store windows
|
||||
@ -116,21 +117,21 @@ app.on('ready', () => {
|
||||
app.addRecentDocument('/Users/USERNAME/Desktop/work.type');
|
||||
app.clearRecentDocuments();
|
||||
var dockMenu = Menu.buildFromTemplate([
|
||||
<GitHubElectron.MenuItemOptions>{
|
||||
<Electron.MenuItemOptions>{
|
||||
label: 'New Window',
|
||||
click: () => {
|
||||
console.log('New Window');
|
||||
}
|
||||
},
|
||||
<GitHubElectron.MenuItemOptions>{
|
||||
<Electron.MenuItemOptions>{
|
||||
label: 'New Window with Settings',
|
||||
submenu: [
|
||||
<GitHubElectron.MenuItemOptions>{ label: 'Basic' },
|
||||
<GitHubElectron.MenuItemOptions>{ label: 'Pro' }
|
||||
<Electron.MenuItemOptions>{ label: 'Basic' },
|
||||
<Electron.MenuItemOptions>{ label: 'Pro' }
|
||||
]
|
||||
},
|
||||
<GitHubElectron.MenuItemOptions>{ label: 'New Command...' },
|
||||
<GitHubElectron.MenuItemOptions>{
|
||||
<Electron.MenuItemOptions>{ label: 'New Command...' },
|
||||
<Electron.MenuItemOptions>{
|
||||
label: 'Edit',
|
||||
submenu: [
|
||||
{
|
||||
@ -167,7 +168,7 @@ var dockMenu = Menu.buildFromTemplate([
|
||||
app.dock.setMenu(dockMenu);
|
||||
|
||||
app.setUserTasks([
|
||||
<GitHubElectron.Task>{
|
||||
<Electron.Task>{
|
||||
program: process.execPath,
|
||||
arguments: '--new-window',
|
||||
iconPath: process.execPath,
|
||||
@ -186,7 +187,7 @@ window.setDocumentEdited(true);
|
||||
// Online/Offline Event Detection
|
||||
// https://github.com/atom/electron/blob/master/docs/tutorial/online-offline-events.md
|
||||
|
||||
var onlineStatusWindow: GitHubElectron.BrowserWindow;
|
||||
var onlineStatusWindow: Electron.BrowserWindow;
|
||||
|
||||
app.on('ready', () => {
|
||||
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
||||
@ -275,12 +276,12 @@ globalShortcut.unregisterAll();
|
||||
// ipcMain
|
||||
// https://github.com/atom/electron/blob/master/docs/api/ipc-main-process.md
|
||||
|
||||
ipcMain.on('asynchronous-message', (event: GitHubElectron.IPCMainEvent, arg: any) => {
|
||||
ipcMain.on('asynchronous-message', (event: Electron.IPCMainEvent, arg: any) => {
|
||||
console.log(arg); // prints "ping"
|
||||
event.sender.send('asynchronous-reply', 'pong');
|
||||
});
|
||||
|
||||
ipcMain.on('synchronous-message', (event: GitHubElectron.IPCMainEvent, arg: any) => {
|
||||
ipcMain.on('synchronous-message', (event: Electron.IPCMainEvent, arg: any) => {
|
||||
console.log(arg); // prints "ping"
|
||||
event.returnValue = 'pong';
|
||||
});
|
||||
@ -460,7 +461,7 @@ app.on('ready', () => {
|
||||
// tray
|
||||
// https://github.com/atom/electron/blob/master/docs/api/tray.md
|
||||
|
||||
var appIcon: GitHubElectron.Tray = null;
|
||||
var appIcon: Electron.Tray = null;
|
||||
app.on('ready', () => {
|
||||
appIcon = new Tray('/path/to/my/icon');
|
||||
var contextMenu = Menu.buildFromTemplate([
|
||||
|
||||
@ -24,7 +24,7 @@ ipcRenderer.send('asynchronous-message', 'ping');
|
||||
// remote
|
||||
// https://github.com/atom/electron/blob/master/docs/api/remote.md
|
||||
|
||||
var BrowserWindow: typeof GitHubElectron.BrowserWindow = remote.require('browser-window');
|
||||
var BrowserWindow: typeof Electron.BrowserWindow = remote.require('browser-window');
|
||||
var win = new BrowserWindow({ width: 800, height: 600 });
|
||||
win.loadURL('https://github.com');
|
||||
|
||||
@ -75,7 +75,7 @@ crashReporter.start({
|
||||
// nativeImage
|
||||
// https://github.com/atom/electron/blob/master/docs/api/native-image.md
|
||||
|
||||
var Tray: typeof GitHubElectron.Tray = remote.require('Tray');
|
||||
var Tray: typeof Electron.Tray = remote.require('Tray');
|
||||
var appIcon2 = new Tray('/Users/somebody/images/icon.png');
|
||||
var window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' });
|
||||
var image = clipboard.readImage();
|
||||
@ -85,9 +85,9 @@ var appIcon4 = new Tray('/Users/somebody/images/icon.png');
|
||||
// screen
|
||||
// https://github.com/atom/electron/blob/master/docs/api/screen.md
|
||||
|
||||
var app: GitHubElectron.App = remote.require('app');
|
||||
var app: Electron.App = remote.require('app');
|
||||
|
||||
var mainWindow: GitHubElectron.BrowserWindow = null;
|
||||
var mainWindow: Electron.BrowserWindow = null;
|
||||
|
||||
app.on('ready', () => {
|
||||
var size = screen.getPrimaryDisplay().workAreaSize;
|
||||
|
||||
4
github-electron/github-electron.d.ts
vendored
4
github-electron/github-electron.d.ts
vendored
@ -914,7 +914,7 @@ declare module Electron {
|
||||
* Should be specified for submenu type menu item, when it's specified the
|
||||
* type: 'submenu' can be omitted for the menu item
|
||||
*/
|
||||
submenu?: Menu;
|
||||
submenu?: Menu|MenuItemOptions[];
|
||||
/**
|
||||
* Unique within a single menu. If defined then it can be used as a reference
|
||||
* to this item by the position attribute.
|
||||
@ -1879,4 +1879,4 @@ declare module 'electron' {
|
||||
|
||||
interface NodeRequireFunction {
|
||||
(moduleName: 'electron'): Electron.ElectronMainAndRenderer;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user