From beb4696b23f0f08efca1d262a29b4c518738468f Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 13:17:38 +0900 Subject: [PATCH 001/328] first commit --- npm/.gitignore | 5 +++++ npm/README.md | 8 ++++++++ npm/darwin.sh | 2 ++ npm/install.js | 21 +++++++++++++++++++++ npm/package.json | 19 +++++++++++++++++++ 5 files changed, 55 insertions(+) create mode 100644 npm/.gitignore create mode 100644 npm/README.md create mode 100755 npm/darwin.sh create mode 100755 npm/install.js create mode 100644 npm/package.json diff --git a/npm/.gitignore b/npm/.gitignore new file mode 100644 index 000000000000..fdd90df813f3 --- /dev/null +++ b/npm/.gitignore @@ -0,0 +1,5 @@ +node_modules +*.zip +darwin/ +win32/ +linux/ \ No newline at end of file diff --git a/npm/README.md b/npm/README.md new file mode 100644 index 000000000000..64993685d5b1 --- /dev/null +++ b/npm/README.md @@ -0,0 +1,8 @@ +# atom-shell + +Install [atom-shell](https://github.com/atom/atom-shell) prebuilts using npm + +``` +npm install -g atom-shell +atom-shell # will open atom shell +``` \ No newline at end of file diff --git a/npm/darwin.sh b/npm/darwin.sh new file mode 100755 index 000000000000..7c88674c0266 --- /dev/null +++ b/npm/darwin.sh @@ -0,0 +1,2 @@ +#!/bin/bash +./darwin/Atom.app/Contents/MacOS/Atom \ No newline at end of file diff --git a/npm/install.js b/npm/install.js new file mode 100755 index 000000000000..99a18947b932 --- /dev/null +++ b/npm/install.js @@ -0,0 +1,21 @@ +#!/usr/bin/env node + +var os = require('os') +var path = require('path') +var nugget = require('nugget') +var extract = require('extract-zip') + +var version = '0.18.0' +var name = version+'-atom-shell.zip' +var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+os.platform()+'-'+os.arch()+'.zip' + +var onerror = function(err) { + throw err +} + +nugget(url, {target:name, dir:__dirname, resume:true}, function(err) { + if (err) return onerror(err) + extract(path.join(__dirname, name), {dir:path.join(__dirname, os.platform())}, function(err) { + if (err) return onerror(err) + }) +}) diff --git a/npm/package.json b/npm/package.json new file mode 100644 index 000000000000..2b0cf0419c44 --- /dev/null +++ b/npm/package.json @@ -0,0 +1,19 @@ +{ + "name": "atom-shell", + "version": "1.0.0", + "description": "Install atom-shell prebuilts using npm", + "scripts": { + "install": "./install.js" + }, + "bin": { + "atom-shell": "./darwin.sh" + }, + "main": "install.js", + "dependencies": { + "extract-zip": "^1.0.3", + "nugget": "^1.1.2" + }, + "devDependencies": {}, + "author": "Mathias Buus", + "license": "MIT" +} From 2a1e246e2a6b812711f879cf611a4a79ce6e3269 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 13:17:47 +0900 Subject: [PATCH 002/328] reset version --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 2b0cf0419c44..fd06be8cd0af 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "1.0.0", + "version": "0.0.0", "description": "Install atom-shell prebuilts using npm", "scripts": { "install": "./install.js" From 576add15cfa78f10ef52e1622058eb50b8d51dc3 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 13:17:49 +0900 Subject: [PATCH 003/328] 1.0.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index fd06be8cd0af..2b0cf0419c44 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.0.0", + "version": "1.0.0", "description": "Install atom-shell prebuilts using npm", "scripts": { "install": "./install.js" From 7e2ce00b2104e8916d52eeb3ed83958e13ff92c4 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 13:26:56 +0900 Subject: [PATCH 004/328] add missing fields --- npm/package.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 2b0cf0419c44..9e2de571e8f4 100644 --- a/npm/package.json +++ b/npm/package.json @@ -2,6 +2,10 @@ "name": "atom-shell", "version": "1.0.0", "description": "Install atom-shell prebuilts using npm", + "repository": { + "type": "git", + "url": "https://github.com/mafintosh/atom-shell" + }, "scripts": { "install": "./install.js" }, @@ -15,5 +19,9 @@ }, "devDependencies": {}, "author": "Mathias Buus", - "license": "MIT" + "license": "MIT", + "bugs": { + "url": "https://github.com/mafintosh/atom-shell/issues" + }, + "homepage": "https://github.com/mafintosh/atom-shell" } From 0d2b6145063ad60491d01051a024a0e817c1f7f4 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Mon, 20 Oct 2014 13:36:12 +0900 Subject: [PATCH 005/328] update readme --- npm/README.md | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/npm/README.md b/npm/README.md index 64993685d5b1..5ed67e5c0592 100644 --- a/npm/README.md +++ b/npm/README.md @@ -1,8 +1,35 @@ # atom-shell -Install [atom-shell](https://github.com/atom/atom-shell) prebuilts using npm +Install [atom-shell](https://github.com/atom/atom-shell) prebuilt binaries for command-line use using npm. Works on Mac, Windows and Linux. + +Atom Shell is a javascript runtime that bundles Node.js and Chromium. You use it similar to the `node` command on the command line for executing javascript programs. This module helps you easily install the `atom-shell` command for use on the command line without having to compile anything. + +## Installation + +Download and install the latest build of atom-shell for your OS and symlink it into your PATH: ``` npm install -g atom-shell -atom-shell # will open atom shell -``` \ No newline at end of file +``` + +If that command fails with an `EACCESS` error you may have to run it again with `sudo`: + +``` +sudo npm install -g atom-shell +``` + +Now you can just run `atom-shell` to run atom-shell: + +``` +atom-shell +``` + +## Usage + +First you have to [write an atom shell application](https://github.com/atom/atom-shell/blob/master/docs/tutorial/quick-start.md#write-your-first-atom-shell-app) + +Then you can run your app using: + +``` +atom-shell your-app/ +``` From 359504809bac63f78ed7a21596cab66543e92bc2 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Mon, 20 Oct 2014 13:40:19 +0900 Subject: [PATCH 006/328] 1.0.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 9e2de571e8f4..efd247d89945 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "1.0.0", + "version": "1.0.1", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From c1dc3e09a84ad1d9bf9640172c23d6fc72d90e04 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 13:56:49 +0900 Subject: [PATCH 007/328] better cross platform support --- npm/.gitignore | 5 ++--- npm/darwin.sh | 2 -- npm/index.js | 3 +++ npm/install.js | 18 +++++++++++++++--- npm/package.json | 4 ++-- 5 files changed, 22 insertions(+), 10 deletions(-) delete mode 100755 npm/darwin.sh create mode 100644 npm/index.js diff --git a/npm/.gitignore b/npm/.gitignore index fdd90df813f3..fabe685fd30d 100644 --- a/npm/.gitignore +++ b/npm/.gitignore @@ -1,5 +1,4 @@ node_modules *.zip -darwin/ -win32/ -linux/ \ No newline at end of file +dist +run.bat diff --git a/npm/darwin.sh b/npm/darwin.sh deleted file mode 100755 index 7c88674c0266..000000000000 --- a/npm/darwin.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./darwin/Atom.app/Contents/MacOS/Atom \ No newline at end of file diff --git a/npm/index.js b/npm/index.js new file mode 100644 index 000000000000..48b753f33b7c --- /dev/null +++ b/npm/index.js @@ -0,0 +1,3 @@ +var fs = require('fs') +var path = require('path') +module.exports = fs.readFileSync(path.join(__dirname, 'run.bat'), 'utf-8') \ No newline at end of file diff --git a/npm/install.js b/npm/install.js index 99a18947b932..f021c2f67763 100755 --- a/npm/install.js +++ b/npm/install.js @@ -4,18 +4,30 @@ var os = require('os') var path = require('path') var nugget = require('nugget') var extract = require('extract-zip') +var fs = require('fs') +var platform = os.platform() +var arch = os.arch() var version = '0.18.0' -var name = version+'-atom-shell.zip' -var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+os.platform()+'-'+os.arch()+'.zip' +var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' +var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' var onerror = function(err) { throw err } +var paths = { + darwin: path.join(__dirname, './dist/Atom.app/Contents/MacOS/Atom'), + linux: path.join(__dirname, './dist/atom'), + win32: path.join(__dirname, './dist/atom.exe') +} + +if (!paths[platform]) throw new Error('Unknown platform: '+platform) + nugget(url, {target:name, dir:__dirname, resume:true}, function(err) { if (err) return onerror(err) - extract(path.join(__dirname, name), {dir:path.join(__dirname, os.platform())}, function(err) { + fs.writeFileSync(path.join(__dirname, 'run.bat'), paths[platform]) + extract(path.join(__dirname, name), {dir:path.join(__dirname, 'dist')}, function(err) { if (err) return onerror(err) }) }) diff --git a/npm/package.json b/npm/package.json index efd247d89945..563d4fe78015 100644 --- a/npm/package.json +++ b/npm/package.json @@ -10,9 +10,9 @@ "install": "./install.js" }, "bin": { - "atom-shell": "./darwin.sh" + "atom-shell": "run.bat" }, - "main": "install.js", + "main": "index.js", "dependencies": { "extract-zip": "^1.0.3", "nugget": "^1.1.2" From a685e2d545ebeeddc8fe09407a590dc1b166d5cd Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 14:00:19 +0900 Subject: [PATCH 008/328] 1.1.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 563d4fe78015..2c1850dcb517 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "1.0.1", + "version": "1.1.0", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From a8f6fc1005822ded2b650ea15e560b2e1781b3c8 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 14:02:57 +0900 Subject: [PATCH 009/328] bundle empty run.bat --- npm/.gitignore | 1 - npm/run.bat | 0 2 files changed, 1 deletion(-) create mode 100644 npm/run.bat diff --git a/npm/.gitignore b/npm/.gitignore index fabe685fd30d..f424fa1e9d6d 100644 --- a/npm/.gitignore +++ b/npm/.gitignore @@ -1,4 +1,3 @@ node_modules *.zip dist -run.bat diff --git a/npm/run.bat b/npm/run.bat new file mode 100644 index 000000000000..e69de29bb2d1 From 88f796c57438e5945c79dd8806660e73eb8001af Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 14:04:37 +0900 Subject: [PATCH 010/328] 1.1.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 2c1850dcb517..beb6aa5ea1d8 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "1.1.0", + "version": "1.1.1", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From c074689930887da225a32c906948d324dc8c7084 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 14:16:38 +0900 Subject: [PATCH 011/328] better windows support --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index beb6aa5ea1d8..bfde52f5884d 100644 --- a/npm/package.json +++ b/npm/package.json @@ -7,7 +7,7 @@ "url": "https://github.com/mafintosh/atom-shell" }, "scripts": { - "install": "./install.js" + "install": "node install.js" }, "bin": { "atom-shell": "run.bat" From 9cd9d09ef76ac95b349fe3d6ebd00226d768a027 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 14:16:46 +0900 Subject: [PATCH 012/328] 1.1.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index bfde52f5884d..434a7ef462f7 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "1.1.1", + "version": "1.1.2", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 93f5cc7d796c3d5829e5248c66079ac772324de1 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Mon, 20 Oct 2014 14:39:17 +0900 Subject: [PATCH 013/328] update readme --- npm/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/npm/README.md b/npm/README.md index 5ed67e5c0592..acbf6f34c7e9 100644 --- a/npm/README.md +++ b/npm/README.md @@ -1,6 +1,8 @@ # atom-shell -Install [atom-shell](https://github.com/atom/atom-shell) prebuilt binaries for command-line use using npm. Works on Mac, Windows and Linux. +Install [atom-shell](https://github.com/atom/atom-shell) prebuilt binaries for command-line use using npm. + +Works on Mac, Windows and Linux OSes that Atom Shell supports (e.g. Atom Shell [does not support Windows XP](https://github.com/atom/atom-shell/issues/691)). Atom Shell is a javascript runtime that bundles Node.js and Chromium. You use it similar to the `node` command on the command line for executing javascript programs. This module helps you easily install the `atom-shell` command for use on the command line without having to compile anything. From 1f3c285ccf07703860d46110aab0359b6a522d46 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 14:38:15 +0900 Subject: [PATCH 014/328] fix spaces in path issue --- npm/index.js | 2 +- npm/install.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/index.js b/npm/index.js index 48b753f33b7c..1e82e73a758e 100644 --- a/npm/index.js +++ b/npm/index.js @@ -1,3 +1,3 @@ var fs = require('fs') var path = require('path') -module.exports = fs.readFileSync(path.join(__dirname, 'run.bat'), 'utf-8') \ No newline at end of file +module.exports = fs.readFileSync(path.join(__dirname, 'run.bat'), 'utf-8').slice(1,-1) \ No newline at end of file diff --git a/npm/install.js b/npm/install.js index f021c2f67763..1417c27d25b0 100755 --- a/npm/install.js +++ b/npm/install.js @@ -26,7 +26,7 @@ if (!paths[platform]) throw new Error('Unknown platform: '+platform) nugget(url, {target:name, dir:__dirname, resume:true}, function(err) { if (err) return onerror(err) - fs.writeFileSync(path.join(__dirname, 'run.bat'), paths[platform]) + fs.writeFileSync(path.join(__dirname, 'run.bat'), '"'+paths[platform]+'"') extract(path.join(__dirname, name), {dir:path.join(__dirname, 'dist')}, function(err) { if (err) return onerror(err) }) From d28d2d9c23997a1f9a2d6c532e6a8c28f4d181c9 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 14:39:23 +0900 Subject: [PATCH 015/328] add travis --- npm/.travis.yml | 3 +++ npm/README.md | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 npm/.travis.yml diff --git a/npm/.travis.yml b/npm/.travis.yml new file mode 100644 index 000000000000..244b7e88e327 --- /dev/null +++ b/npm/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - '0.10' diff --git a/npm/README.md b/npm/README.md index acbf6f34c7e9..cd8b8eca38c9 100644 --- a/npm/README.md +++ b/npm/README.md @@ -1,5 +1,7 @@ # atom-shell +[![build status](http://img.shields.io/travis/mafintosh/atom-shell.svg?style=flat)](http://travis-ci.org/mafintosh/atom-shell) + Install [atom-shell](https://github.com/atom/atom-shell) prebuilt binaries for command-line use using npm. Works on Mac, Windows and Linux OSes that Atom Shell supports (e.g. Atom Shell [does not support Windows XP](https://github.com/atom/atom-shell/issues/691)). From f23cdf8d18215302397a8c4702f1a3f41f236319 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 14:40:49 +0900 Subject: [PATCH 016/328] 1.1.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 434a7ef462f7..90f59b2d4133 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "1.1.2", + "version": "1.1.3", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 74c7a9455bade14bbb3edd36bede4abad1eb01d4 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 14:52:02 +0900 Subject: [PATCH 017/328] make travis build From 1bbd199e34ad118e637a155ddbb10b2f745f0877 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 14:56:57 +0900 Subject: [PATCH 018/328] add tests --- npm/package.json | 7 +++++-- npm/test/index.js | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 npm/test/index.js diff --git a/npm/package.json b/npm/package.json index 90f59b2d4133..14ec14179ce1 100644 --- a/npm/package.json +++ b/npm/package.json @@ -7,7 +7,8 @@ "url": "https://github.com/mafintosh/atom-shell" }, "scripts": { - "install": "node install.js" + "install": "node install.js", + "test": "tape test/*.js" }, "bin": { "atom-shell": "run.bat" @@ -17,7 +18,9 @@ "extract-zip": "^1.0.3", "nugget": "^1.1.2" }, - "devDependencies": {}, + "devDependencies": { + "tape": "^3.0.1" + }, "author": "Mathias Buus", "license": "MIT", "bugs": { diff --git a/npm/test/index.js b/npm/test/index.js new file mode 100644 index 000000000000..ba59de191156 --- /dev/null +++ b/npm/test/index.js @@ -0,0 +1,8 @@ +var tape = require('tape') +var atom = require('../') +var fs = require('fs') + +tape('has binary', function(t) { + t.ok(fs.existsSync(atom), 'atom-shell was downloaded') + t.end() +}) \ No newline at end of file From 4708eba69e9f1fa59d2c0d7f212fd96d21021b28 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 14:57:00 +0900 Subject: [PATCH 019/328] 1.1.4 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 14ec14179ce1..20a489ed0e1e 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "1.1.3", + "version": "1.1.4", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From eb04836d51dc322a85123fe2b48f85b12bfff914 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 20 Oct 2014 16:16:35 +0900 Subject: [PATCH 020/328] add programmatic usage --- npm/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/npm/README.md b/npm/README.md index cd8b8eca38c9..04e7c53c90fa 100644 --- a/npm/README.md +++ b/npm/README.md @@ -37,3 +37,19 @@ Then you can run your app using: ``` atom-shell your-app/ ``` + +## Programmatic usage + +If you require `atom-shell` inside your node app it will return the file path to the binary. +Use this to spawn atom shell + +``` js +var atom = require('atom-shell') +var proc = require('child_process') + +// will something similar to print /Users/maf/.../Atom +console.log(atom) + +// spawn atom-shell +var child = proc.spawn(atom) +``` \ No newline at end of file From 572220aa8496cca3902ab5ef0d985a76cc6b1276 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Tue, 21 Oct 2014 14:41:57 +0900 Subject: [PATCH 021/328] bump nugget --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 20a489ed0e1e..0acac8cb2bb6 100644 --- a/npm/package.json +++ b/npm/package.json @@ -16,7 +16,7 @@ "main": "index.js", "dependencies": { "extract-zip": "^1.0.3", - "nugget": "^1.1.2" + "nugget": "^1.2.0" }, "devDependencies": { "tape": "^3.0.1" From d0a0afdd71f7b33b3612360ce0da25276b9c4490 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Tue, 21 Oct 2014 14:42:55 +0900 Subject: [PATCH 022/328] set verbose mode --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 1417c27d25b0..8281bc57ee4a 100755 --- a/npm/install.js +++ b/npm/install.js @@ -24,7 +24,7 @@ var paths = { if (!paths[platform]) throw new Error('Unknown platform: '+platform) -nugget(url, {target:name, dir:__dirname, resume:true}, function(err) { +nugget(url, {target:name, dir:__dirname, resume:true, verbose:true}, function(err) { if (err) return onerror(err) fs.writeFileSync(path.join(__dirname, 'run.bat'), '"'+paths[platform]+'"') extract(path.join(__dirname, name), {dir:path.join(__dirname, 'dist')}, function(err) { From 3ac73f7e918e82ddbd89d7894f790c5f21ecaba1 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Tue, 21 Oct 2014 14:43:02 +0900 Subject: [PATCH 023/328] 1.1.5 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 0acac8cb2bb6..2a1f0a72e460 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "1.1.4", + "version": "1.1.5", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From df429907705314c5e7813b407fa80ec620246633 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Sat, 15 Nov 2014 10:11:09 +0100 Subject: [PATCH 024/328] forward arguments --- npm/install.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 8281bc57ee4a..ec0b66f1ab07 100755 --- a/npm/install.js +++ b/npm/install.js @@ -22,11 +22,17 @@ var paths = { win32: path.join(__dirname, './dist/atom.exe') } +var argv = { + darwin: '"$@"', + linux: '"$@"', + win32: '"$@"' // 90% sure this isn't right +} + if (!paths[platform]) throw new Error('Unknown platform: '+platform) nugget(url, {target:name, dir:__dirname, resume:true, verbose:true}, function(err) { if (err) return onerror(err) - fs.writeFileSync(path.join(__dirname, 'run.bat'), '"'+paths[platform]+'"') + fs.writeFileSync(path.join(__dirname, 'run.bat'), '"'+paths[platform]+'" '+argv[platform]) extract(path.join(__dirname, name), {dir:path.join(__dirname, 'dist')}, function(err) { if (err) return onerror(err) }) From 0980ba367af62ad9e4f0fd4a64f934e13dcab5f3 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Sat, 15 Nov 2014 10:13:23 +0100 Subject: [PATCH 025/328] arg fwd should also work on windows --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index ec0b66f1ab07..146a4990ad3a 100755 --- a/npm/install.js +++ b/npm/install.js @@ -25,7 +25,7 @@ var paths = { var argv = { darwin: '"$@"', linux: '"$@"', - win32: '"$@"' // 90% sure this isn't right + win32: '%*' // does this work with " " in the args? } if (!paths[platform]) throw new Error('Unknown platform: '+platform) From 8f5714396a372ff2fb5bc94c7a2d7bf10fcbbba0 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Sat, 15 Nov 2014 10:14:52 +0100 Subject: [PATCH 026/328] 1.1.6 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 2a1f0a72e460..1f5636d94baf 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "1.1.5", + "version": "1.1.6", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 99aa39b854a7274f8cae79092c90a3288cffaaa2 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Sat, 15 Nov 2014 10:21:07 +0100 Subject: [PATCH 027/328] separate path file --- npm/index.js | 3 ++- npm/install.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/npm/index.js b/npm/index.js index 1e82e73a758e..d067d7f73fc7 100644 --- a/npm/index.js +++ b/npm/index.js @@ -1,3 +1,4 @@ var fs = require('fs') var path = require('path') -module.exports = fs.readFileSync(path.join(__dirname, 'run.bat'), 'utf-8').slice(1,-1) \ No newline at end of file + +module.exports = fs.readFileSync(path.join(__dirname, 'path.txt'), 'utf-8') \ No newline at end of file diff --git a/npm/install.js b/npm/install.js index 146a4990ad3a..fcc2e7b07103 100755 --- a/npm/install.js +++ b/npm/install.js @@ -32,6 +32,7 @@ if (!paths[platform]) throw new Error('Unknown platform: '+platform) nugget(url, {target:name, dir:__dirname, resume:true, verbose:true}, function(err) { if (err) return onerror(err) + fs.writeFileSync(path.join(__dirname, 'path.txt'), paths[platform]) fs.writeFileSync(path.join(__dirname, 'run.bat'), '"'+paths[platform]+'" '+argv[platform]) extract(path.join(__dirname, name), {dir:path.join(__dirname, 'dist')}, function(err) { if (err) return onerror(err) From cff6b91d468217c0f88776129aae775d0eab2b90 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Sat, 15 Nov 2014 10:21:33 +0100 Subject: [PATCH 028/328] 1.1.7 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 1f5636d94baf..bfaa3d34ad65 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "1.1.6", + "version": "1.1.7", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 6af9dfc915c643e9ca18dac0afe980aab1f2f5bf Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Sat, 22 Nov 2014 20:29:44 +0100 Subject: [PATCH 029/328] add shebang. fixes #4 --- npm/install.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index fcc2e7b07103..12d0d158e370 100755 --- a/npm/install.js +++ b/npm/install.js @@ -22,6 +22,12 @@ var paths = { win32: path.join(__dirname, './dist/atom.exe') } +var shebang = { + darwin: '#!/bin/bash\n', + linux: '#!/bin/bash\n', + win32: '' +} + var argv = { darwin: '"$@"', linux: '"$@"', @@ -33,7 +39,7 @@ if (!paths[platform]) throw new Error('Unknown platform: '+platform) nugget(url, {target:name, dir:__dirname, resume:true, verbose:true}, function(err) { if (err) return onerror(err) fs.writeFileSync(path.join(__dirname, 'path.txt'), paths[platform]) - fs.writeFileSync(path.join(__dirname, 'run.bat'), '"'+paths[platform]+'" '+argv[platform]) + fs.writeFileSync(path.join(__dirname, 'run.bat'), shebang[platform]+'"'+paths[platform]+'" '+argv[platform]) extract(path.join(__dirname, name), {dir:path.join(__dirname, 'dist')}, function(err) { if (err) return onerror(err) }) From ff3019ace6c5eb72831d3f0747b41a03584174b4 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Sat, 22 Nov 2014 20:31:37 +0100 Subject: [PATCH 030/328] 1.1.8 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index bfaa3d34ad65..1e7b6b55996a 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "1.1.7", + "version": "1.1.8", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 6566b9a6a58924e38d6779a5b23d4772a77bdc07 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 1 Dec 2014 14:16:31 +0100 Subject: [PATCH 031/328] bump to 0.19.5 for #5 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 12d0d158e370..b202dc00e45f 100755 --- a/npm/install.js +++ b/npm/install.js @@ -8,7 +8,7 @@ var fs = require('fs') var platform = os.platform() var arch = os.arch() -var version = '0.18.0' +var version = '0.19.5' var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' From c083acae9775c79779925586cefb1e37805041ae Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Mon, 1 Dec 2014 14:27:46 +0100 Subject: [PATCH 032/328] 1.2.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 1e7b6b55996a..2bc31ec8e1e2 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "1.1.8", + "version": "1.2.0", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From c09c7a2248a9e4d66c3ca2d0c7bcbddfe432ca59 Mon Sep 17 00:00:00 2001 From: Grigory Date: Fri, 12 Dec 2014 22:20:20 +0300 Subject: [PATCH 033/328] Fixed 64-bit windows install 64-bit version is not available under Windows, so install fails with 404 download error. Fixed by patching windows install. --- npm/install.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/npm/install.js b/npm/install.js index b202dc00e45f..1d612272e5e3 100755 --- a/npm/install.js +++ b/npm/install.js @@ -8,6 +8,10 @@ var fs = require('fs') var platform = os.platform() var arch = os.arch() +if ('win32' === platform) { + // 64-bit is not available under windows. + arch = 'ia32'; +} var version = '0.19.5' var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' From 99eb5987eebb218c9ed5a91a2b8ae3fd6b12d1f8 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Fri, 12 Dec 2014 14:19:54 -0800 Subject: [PATCH 034/328] 1.2.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 2bc31ec8e1e2..9cb48327e3dc 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "1.2.0", + "version": "1.2.1", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 5841a68f081611d82857dda8c63416351962dbea Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sun, 1 Feb 2015 17:19:38 -0800 Subject: [PATCH 035/328] 0.19.5 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 9cb48327e3dc..ae60d2c771aa 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "1.2.1", + "version": "0.19.5", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 85ee9028bbaead6352bf88f56e28dc99091d70a3 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sun, 1 Feb 2015 17:21:23 -0800 Subject: [PATCH 036/328] 0.20.0 --- npm/install.js | 2 +- npm/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/install.js b/npm/install.js index 1d612272e5e3..204159d50363 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if ('win32' === platform) { // 64-bit is not available under windows. arch = 'ia32'; } -var version = '0.19.5' +var version = '0.20.0' var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' diff --git a/npm/package.json b/npm/package.json index ae60d2c771aa..17a375d4e4d6 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.19.5", + "version": "0.20.0", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From b9fced9f6b9c3488b6da11985b9cda7cc59da4cf Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sun, 1 Feb 2015 17:21:54 -0800 Subject: [PATCH 037/328] 0.20.1 --- npm/install.js | 2 +- npm/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/install.js b/npm/install.js index 204159d50363..aefa4d0c7d6b 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if ('win32' === platform) { // 64-bit is not available under windows. arch = 'ia32'; } -var version = '0.20.0' +var version = '0.20.1' var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' diff --git a/npm/package.json b/npm/package.json index 17a375d4e4d6..583eaba2d7c2 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.20.0", + "version": "0.20.1", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 4b784d03a678c515714dc5ff72e169f7ab8ef343 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sun, 1 Feb 2015 17:22:16 -0800 Subject: [PATCH 038/328] 0.20.2 --- npm/install.js | 2 +- npm/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/install.js b/npm/install.js index aefa4d0c7d6b..a385d64ca03f 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if ('win32' === platform) { // 64-bit is not available under windows. arch = 'ia32'; } -var version = '0.20.1' +var version = '0.20.2' var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' diff --git a/npm/package.json b/npm/package.json index 583eaba2d7c2..dbdc8d4a714a 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.20.1", + "version": "0.20.2", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 384266ce7605c31e35d80be31da91901677bfef0 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sun, 1 Feb 2015 17:22:44 -0800 Subject: [PATCH 039/328] 0.20.3 --- npm/install.js | 2 +- npm/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/install.js b/npm/install.js index a385d64ca03f..74821be0cf76 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if ('win32' === platform) { // 64-bit is not available under windows. arch = 'ia32'; } -var version = '0.20.2' +var version = '0.20.3' var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' diff --git a/npm/package.json b/npm/package.json index dbdc8d4a714a..fe62c27ac096 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.20.2", + "version": "0.20.3", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 2b4e4622c54f0931929b0c238a68a8991bf4e889 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sun, 1 Feb 2015 17:23:02 -0800 Subject: [PATCH 040/328] 0.20.4 --- npm/install.js | 2 +- npm/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/install.js b/npm/install.js index 74821be0cf76..e4428afae3e9 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if ('win32' === platform) { // 64-bit is not available under windows. arch = 'ia32'; } -var version = '0.20.3' +var version = '0.20.4' var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' diff --git a/npm/package.json b/npm/package.json index fe62c27ac096..135f325602ec 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.20.3", + "version": "0.20.4", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 049e98813795df31432f7773b477cd12ea39b8e6 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sun, 1 Feb 2015 17:23:21 -0800 Subject: [PATCH 041/328] 0.20.5 --- npm/install.js | 2 +- npm/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/install.js b/npm/install.js index e4428afae3e9..ecf216ce3023 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if ('win32' === platform) { // 64-bit is not available under windows. arch = 'ia32'; } -var version = '0.20.4' +var version = '0.20.5' var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' diff --git a/npm/package.json b/npm/package.json index 135f325602ec..9fea6887c841 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.20.4", + "version": "0.20.5", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 1e2d986430cf0bb89bd9da2fe0e881079a87b3d1 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sun, 1 Feb 2015 17:23:38 -0800 Subject: [PATCH 042/328] 0.20.6 --- npm/install.js | 2 +- npm/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/install.js b/npm/install.js index ecf216ce3023..cf87a9c24009 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if ('win32' === platform) { // 64-bit is not available under windows. arch = 'ia32'; } -var version = '0.20.5' +var version = '0.20.6' var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' diff --git a/npm/package.json b/npm/package.json index 9fea6887c841..11cb43f7c1db 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.20.5", + "version": "0.20.6", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 45c0e7075b9121b7735df4c76d7bc3a6b6c1ec6e Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sun, 1 Feb 2015 17:23:53 -0800 Subject: [PATCH 043/328] 0.20.7 --- npm/install.js | 2 +- npm/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/install.js b/npm/install.js index cf87a9c24009..9a42cb6d8657 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if ('win32' === platform) { // 64-bit is not available under windows. arch = 'ia32'; } -var version = '0.20.6' +var version = '0.20.7' var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' diff --git a/npm/package.json b/npm/package.json index 11cb43f7c1db..de4efe332021 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.20.6", + "version": "0.20.7", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 4060ebcc947d0de7a69098932700194f02c1bf35 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sun, 1 Feb 2015 17:24:10 -0800 Subject: [PATCH 044/328] 0.20.8 --- npm/install.js | 2 +- npm/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/install.js b/npm/install.js index 9a42cb6d8657..9c30311888d3 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if ('win32' === platform) { // 64-bit is not available under windows. arch = 'ia32'; } -var version = '0.20.7' +var version = '0.20.8' var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' diff --git a/npm/package.json b/npm/package.json index de4efe332021..e9cb6b3af14f 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.20.7", + "version": "0.20.8", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From beb6cac8a2fcd496f2c20c176aa5f8c0021d0cd1 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sun, 1 Feb 2015 17:24:30 -0800 Subject: [PATCH 045/328] 0.21.0 --- npm/install.js | 2 +- npm/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/install.js b/npm/install.js index 9c30311888d3..d512778d4ead 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if ('win32' === platform) { // 64-bit is not available under windows. arch = 'ia32'; } -var version = '0.20.8' +var version = '0.21.0' var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' diff --git a/npm/package.json b/npm/package.json index e9cb6b3af14f..6b60bf6d97ac 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.20.8", + "version": "0.21.0", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From d9c358c4d547344fd986b21b834d509104323d85 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sun, 1 Feb 2015 17:25:28 -0800 Subject: [PATCH 046/328] add contributing --- npm/CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 npm/CONTRIBUTING.md diff --git a/npm/CONTRIBUTING.md b/npm/CONTRIBUTING.md new file mode 100644 index 000000000000..d34f8d6bd4a4 --- /dev/null +++ b/npm/CONTRIBUTING.md @@ -0,0 +1 @@ +versions published to npm should match the versions published to [github releases for atom-shell](https://github.com/atom/atom-shell/releases) \ No newline at end of file From 43897e82394854118260a1cb3e4493abb6cb0cff Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Thu, 5 Feb 2015 18:45:24 -0800 Subject: [PATCH 047/328] 0.21.1 --- npm/install.js | 2 +- npm/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/install.js b/npm/install.js index d512778d4ead..db5b273c9d72 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if ('win32' === platform) { // 64-bit is not available under windows. arch = 'ia32'; } -var version = '0.21.0' +var version = '0.21.1' var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' diff --git a/npm/package.json b/npm/package.json index 6b60bf6d97ac..bb63ffca3076 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.21.0", + "version": "0.21.1", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 023ed1c82fa55c33c488d67385f81d0b30ed429e Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Thu, 5 Feb 2015 18:45:56 -0800 Subject: [PATCH 048/328] 0.21.2 --- npm/install.js | 2 +- npm/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/install.js b/npm/install.js index db5b273c9d72..f1522ce20308 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if ('win32' === platform) { // 64-bit is not available under windows. arch = 'ia32'; } -var version = '0.21.1' +var version = '0.21.2' var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' diff --git a/npm/package.json b/npm/package.json index bb63ffca3076..d3549e8df4ac 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.21.1", + "version": "0.21.2", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From fafb79c2e04c032012430a46deb2b877f1eff6d1 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Wed, 4 Mar 2015 13:04:36 -0800 Subject: [PATCH 049/328] 0.21.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index d3549e8df4ac..374cc32600ff 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.21.2", + "version": "0.21.3", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 2a048369fedd6bff1fb273f20baac2c7c1279424 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Wed, 4 Mar 2015 13:04:51 -0800 Subject: [PATCH 050/328] 0.21.3 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index f1522ce20308..35d55231b0a8 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if ('win32' === platform) { // 64-bit is not available under windows. arch = 'ia32'; } -var version = '0.21.2' +var version = '0.21.3' var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' From 1809db56698a8722fcd8e63d7c63ceb1ca0c0d1f Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Wed, 4 Mar 2015 13:08:16 -0800 Subject: [PATCH 051/328] use standard js style --- npm/CONTRIBUTING.md | 6 +++++- npm/index.js | 2 +- npm/install.js | 18 +++++++++--------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/npm/CONTRIBUTING.md b/npm/CONTRIBUTING.md index d34f8d6bd4a4..841c9fd84765 100644 --- a/npm/CONTRIBUTING.md +++ b/npm/CONTRIBUTING.md @@ -1 +1,5 @@ -versions published to npm should match the versions published to [github releases for atom-shell](https://github.com/atom/atom-shell/releases) \ No newline at end of file +versions published to npm should match the versions published to [github releases for atom-shell](https://github.com/atom/atom-shell/releases) + +coding style should be `standard`: + +[![js-standard-style](https://raw.githubusercontent.com/feross/standard/master/badge.png)](https://github.com/feross/standard) diff --git a/npm/index.js b/npm/index.js index d067d7f73fc7..3dd25cc63114 100644 --- a/npm/index.js +++ b/npm/index.js @@ -1,4 +1,4 @@ var fs = require('fs') var path = require('path') -module.exports = fs.readFileSync(path.join(__dirname, 'path.txt'), 'utf-8') \ No newline at end of file +module.exports = fs.readFileSync(path.join(__dirname, 'path.txt'), 'utf-8') diff --git a/npm/install.js b/npm/install.js index 35d55231b0a8..5c8e3d8ab732 100755 --- a/npm/install.js +++ b/npm/install.js @@ -8,15 +8,15 @@ var fs = require('fs') var platform = os.platform() var arch = os.arch() -if ('win32' === platform) { +if (platform === 'win32') { // 64-bit is not available under windows. - arch = 'ia32'; + arch = 'ia32' } var version = '0.21.3' -var name = 'atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' -var url = 'https://github.com/atom/atom-shell/releases/download/v'+version+'/atom-shell-v'+version+'-'+platform+'-'+arch+'.zip' +var filename = 'atom-shell-v' + version + '-' + platform + '-' + arch + '.zip' +var url = 'https://github.com/atom/atom-shell/releases/download/v' + version + '/atom-shell-v' + version + '-' + platform + '-' + arch + '.zip' -var onerror = function(err) { +function onerror (err) { throw err } @@ -38,13 +38,13 @@ var argv = { win32: '%*' // does this work with " " in the args? } -if (!paths[platform]) throw new Error('Unknown platform: '+platform) +if (!paths[platform]) throw new Error('Unknown platform: ' + platform) -nugget(url, {target:name, dir:__dirname, resume:true, verbose:true}, function(err) { +nugget(url, {target: filename, dir: __dirname, resume: true, verbose: true}, function (err) { if (err) return onerror(err) fs.writeFileSync(path.join(__dirname, 'path.txt'), paths[platform]) - fs.writeFileSync(path.join(__dirname, 'run.bat'), shebang[platform]+'"'+paths[platform]+'" '+argv[platform]) - extract(path.join(__dirname, name), {dir:path.join(__dirname, 'dist')}, function(err) { + fs.writeFileSync(path.join(__dirname, 'run.bat'), shebang[platform] + '"' + paths[platform] + '" ' + argv[platform]) + extract(path.join(__dirname, name), {dir: path.join(__dirname, 'dist')}, function (err) { if (err) return onerror(err) }) }) From 82d67824790161222ca34da789d1f26577d8667c Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Wed, 4 Mar 2015 13:14:47 -0800 Subject: [PATCH 052/328] fix typo --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 5c8e3d8ab732..1c450deb2b7a 100755 --- a/npm/install.js +++ b/npm/install.js @@ -44,7 +44,7 @@ nugget(url, {target: filename, dir: __dirname, resume: true, verbose: true}, fun if (err) return onerror(err) fs.writeFileSync(path.join(__dirname, 'path.txt'), paths[platform]) fs.writeFileSync(path.join(__dirname, 'run.bat'), shebang[platform] + '"' + paths[platform] + '" ' + argv[platform]) - extract(path.join(__dirname, name), {dir: path.join(__dirname, 'dist')}, function (err) { + extract(path.join(__dirname, filename), {dir: path.join(__dirname, 'dist')}, function (err) { if (err) return onerror(err) }) }) From 9679e68f7aa8862ffc638aab298a2e02bae5149a Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Wed, 4 Mar 2015 13:17:38 -0800 Subject: [PATCH 053/328] 0.21.3-1 (0.21.3 had a bug on our end, sorry) --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 374cc32600ff..904c5f90bec8 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.21.3", + "version": "0.21.3-1", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From f0492b803bb3a89c9aa0689614fa266826488342 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Wed, 18 Mar 2015 15:40:10 -0700 Subject: [PATCH 054/328] 0.22.0 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 1c450deb2b7a..f878629d820d 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if (platform === 'win32') { // 64-bit is not available under windows. arch = 'ia32' } -var version = '0.21.3' +var version = '0.22.0' var filename = 'atom-shell-v' + version + '-' + platform + '-' + arch + '.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v' + version + '/atom-shell-v' + version + '-' + platform + '-' + arch + '.zip' From 98ced7f077230d346630c0b8fd9ac35507934902 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Wed, 18 Mar 2015 15:40:13 -0700 Subject: [PATCH 055/328] 0.22.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 904c5f90bec8..dee0bc78511c 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.21.3-1", + "version": "0.22.0", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 6c43acbb8da0325543025627861f74a28bd8a53d Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Wed, 18 Mar 2015 15:40:25 -0700 Subject: [PATCH 056/328] 0.22.1 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index f878629d820d..1b90bff99039 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if (platform === 'win32') { // 64-bit is not available under windows. arch = 'ia32' } -var version = '0.22.0' +var version = '0.22.1' var filename = 'atom-shell-v' + version + '-' + platform + '-' + arch + '.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v' + version + '/atom-shell-v' + version + '-' + platform + '-' + arch + '.zip' From 7eb594d6b567b4b8f819770adb05575d6aaeddab Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Wed, 18 Mar 2015 15:40:27 -0700 Subject: [PATCH 057/328] 0.22.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index dee0bc78511c..b77125e81a85 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.22.0", + "version": "0.22.1", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From f04376455dcf42bf997658ce63039882a16852b0 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Wed, 25 Mar 2015 17:56:46 -0700 Subject: [PATCH 058/328] add --save-dev instructions to readme --- npm/README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/npm/README.md b/npm/README.md index 04e7c53c90fa..58f9fd1c4d4a 100644 --- a/npm/README.md +++ b/npm/README.md @@ -10,7 +10,15 @@ Atom Shell is a javascript runtime that bundles Node.js and Chromium. You use it ## Installation -Download and install the latest build of atom-shell for your OS and symlink it into your PATH: +Download and install the latest build of atom-shell for your OS and add it to your projects `package.json` as a `devDependency`: + +``` +npm install atom-shell --save-dev +``` + +This is the preferred way to use atom-shell, as it doesn't require users to install atom-shell globally. + +You can also use the `-g` flag (global) to symlink it into your PATH: ``` npm install -g atom-shell @@ -52,4 +60,4 @@ console.log(atom) // spawn atom-shell var child = proc.spawn(atom) -``` \ No newline at end of file +``` From 8b6f0b42e7ff82ad2b3de873f44e162f1aa12405 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Tue, 31 Mar 2015 11:58:34 -0700 Subject: [PATCH 059/328] 0.22.2 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 1b90bff99039..228a98fb0fa4 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if (platform === 'win32') { // 64-bit is not available under windows. arch = 'ia32' } -var version = '0.22.1' +var version = '0.22.2' var filename = 'atom-shell-v' + version + '-' + platform + '-' + arch + '.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v' + version + '/atom-shell-v' + version + '-' + platform + '-' + arch + '.zip' From a6f10891004d1048b312c4e5c2da9fe0e347d3da Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Tue, 31 Mar 2015 11:58:38 -0700 Subject: [PATCH 060/328] 0.22.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index b77125e81a85..2d06ae85aaf6 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.22.1", + "version": "0.22.2", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 7f925cb5f4d80084866a4fb2bd0728d932e716a1 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Tue, 31 Mar 2015 11:59:11 -0700 Subject: [PATCH 061/328] 0.22.3 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 228a98fb0fa4..8ea1d66f3ed8 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ if (platform === 'win32') { // 64-bit is not available under windows. arch = 'ia32' } -var version = '0.22.2' +var version = '0.22.3' var filename = 'atom-shell-v' + version + '-' + platform + '-' + arch + '.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v' + version + '/atom-shell-v' + version + '-' + platform + '-' + arch + '.zip' From 008535029ab41db141893d14ae0a7a8050eb345a Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Tue, 31 Mar 2015 11:59:15 -0700 Subject: [PATCH 062/328] 0.22.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 2d06ae85aaf6..65876802176f 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.22.2", + "version": "0.22.3", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From cb161234e50ff37573075195c86c36a4d13e1ef4 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Sun, 12 Apr 2015 01:36:42 -0700 Subject: [PATCH 063/328] v0.23.0 --- npm/install.js | 6 +----- npm/package.json | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/npm/install.js b/npm/install.js index 8ea1d66f3ed8..d27e496ed643 100755 --- a/npm/install.js +++ b/npm/install.js @@ -8,11 +8,7 @@ var fs = require('fs') var platform = os.platform() var arch = os.arch() -if (platform === 'win32') { - // 64-bit is not available under windows. - arch = 'ia32' -} -var version = '0.22.3' +var version = '0.23.0' var filename = 'atom-shell-v' + version + '-' + platform + '-' + arch + '.zip' var url = 'https://github.com/atom/atom-shell/releases/download/v' + version + '/atom-shell-v' + version + '-' + platform + '-' + arch + '.zip' diff --git a/npm/package.json b/npm/package.json index 65876802176f..ffd1ba4ce050 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "atom-shell", - "version": "0.22.3", + "version": "0.23.0", "description": "Install atom-shell prebuilts using npm", "repository": { "type": "git", From 698d0c5e70d9914e62e0b47606c6c61e42d71e11 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Fri, 17 Apr 2015 11:19:50 -0700 Subject: [PATCH 064/328] rename to electron-prebuilt --- npm/.gitignore | 1 + npm/CONTRIBUTING.md | 2 +- npm/README.md | 42 +++++++++++++++++++++--------------------- npm/install.js | 12 ++++++------ npm/package.json | 12 ++++++------ npm/path.txt | 1 + npm/run.bat | 2 ++ npm/test/index.js | 4 ++-- 8 files changed, 40 insertions(+), 36 deletions(-) create mode 100644 npm/path.txt mode change 100644 => 100755 npm/run.bat diff --git a/npm/.gitignore b/npm/.gitignore index f424fa1e9d6d..8e1d95c3c414 100644 --- a/npm/.gitignore +++ b/npm/.gitignore @@ -1,3 +1,4 @@ node_modules *.zip dist +.DS_Store \ No newline at end of file diff --git a/npm/CONTRIBUTING.md b/npm/CONTRIBUTING.md index 841c9fd84765..97cd1958d524 100644 --- a/npm/CONTRIBUTING.md +++ b/npm/CONTRIBUTING.md @@ -1,4 +1,4 @@ -versions published to npm should match the versions published to [github releases for atom-shell](https://github.com/atom/atom-shell/releases) +versions published to npm should match the versions published to [github releases for electron](https://github.com/atom/electron/releases) coding style should be `standard`: diff --git a/npm/README.md b/npm/README.md index 58f9fd1c4d4a..07252a254fb2 100644 --- a/npm/README.md +++ b/npm/README.md @@ -1,63 +1,63 @@ -# atom-shell +# electron-prebuilt -[![build status](http://img.shields.io/travis/mafintosh/atom-shell.svg?style=flat)](http://travis-ci.org/mafintosh/atom-shell) +[![build status](http://img.shields.io/travis/mafintosh/electron-prebuilt.svg?style=flat)](http://travis-ci.org/mafintosh/electron-prebuilt) -Install [atom-shell](https://github.com/atom/atom-shell) prebuilt binaries for command-line use using npm. +Install [electron](https://github.com/atom/electron) (formerly called **atom-shell**) prebuilt binaries for command-line use using npm. -Works on Mac, Windows and Linux OSes that Atom Shell supports (e.g. Atom Shell [does not support Windows XP](https://github.com/atom/atom-shell/issues/691)). +Works on Mac, Windows and Linux OSes that Electron supports (e.g. Electron [does not support Windows XP](https://github.com/atom/electron/issues/691)). -Atom Shell is a javascript runtime that bundles Node.js and Chromium. You use it similar to the `node` command on the command line for executing javascript programs. This module helps you easily install the `atom-shell` command for use on the command line without having to compile anything. +Electron is a javascript runtime that bundles Node.js and Chromium. You use it similar to the `node` command on the command line for executing javascript programs. This module helps you easily install the `electron` command for use on the command line without having to compile anything. ## Installation -Download and install the latest build of atom-shell for your OS and add it to your projects `package.json` as a `devDependency`: +Download and install the latest build of electron for your OS and add it to your projects `package.json` as a `devDependency`: ``` -npm install atom-shell --save-dev +npm install electron-prebuilt --save-dev ``` -This is the preferred way to use atom-shell, as it doesn't require users to install atom-shell globally. +This is the preferred way to use electron, as it doesn't require users to install electron globally. You can also use the `-g` flag (global) to symlink it into your PATH: ``` -npm install -g atom-shell +npm install -g electron-prebuilt ``` If that command fails with an `EACCESS` error you may have to run it again with `sudo`: ``` -sudo npm install -g atom-shell +sudo npm install -g electron-prebuilt ``` -Now you can just run `atom-shell` to run atom-shell: +Now you can just run `electron` to run electron: ``` -atom-shell +electron ``` ## Usage -First you have to [write an atom shell application](https://github.com/atom/atom-shell/blob/master/docs/tutorial/quick-start.md#write-your-first-atom-shell-app) +First you have to [write an electron application](https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md) Then you can run your app using: ``` -atom-shell your-app/ +electron your-app/ ``` ## Programmatic usage -If you require `atom-shell` inside your node app it will return the file path to the binary. -Use this to spawn atom shell +If you require `electron-prebuilt` inside your node app it will return the file path to the binary. +Use this to spawn electron ``` js -var atom = require('atom-shell') +var electron = require('electron-prebuilt') var proc = require('child_process') -// will something similar to print /Users/maf/.../Atom -console.log(atom) +// will something similar to print /Users/maf/.../Electron +console.log(electron) -// spawn atom-shell -var child = proc.spawn(atom) +// spawn electron +var child = proc.spawn(electron) ``` diff --git a/npm/install.js b/npm/install.js index d27e496ed643..ad0201f227c4 100755 --- a/npm/install.js +++ b/npm/install.js @@ -8,18 +8,18 @@ var fs = require('fs') var platform = os.platform() var arch = os.arch() -var version = '0.23.0' -var filename = 'atom-shell-v' + version + '-' + platform + '-' + arch + '.zip' -var url = 'https://github.com/atom/atom-shell/releases/download/v' + version + '/atom-shell-v' + version + '-' + platform + '-' + arch + '.zip' +var version = '0.24.0' +var filename = 'electron-v' + version + '-' + platform + '-' + arch + '.zip' +var url = 'https://github.com/atom/electron/releases/download/v' + version + '/electron-v' + version + '-' + platform + '-' + arch + '.zip' function onerror (err) { throw err } var paths = { - darwin: path.join(__dirname, './dist/Atom.app/Contents/MacOS/Atom'), - linux: path.join(__dirname, './dist/atom'), - win32: path.join(__dirname, './dist/atom.exe') + darwin: path.join(__dirname, './dist/Electron.app/Contents/MacOS/Electron'), + linux: path.join(__dirname, './dist/electron'), + win32: path.join(__dirname, './dist/electron.exe') } var shebang = { diff --git a/npm/package.json b/npm/package.json index ffd1ba4ce050..fb8e95153776 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,17 +1,17 @@ { - "name": "atom-shell", + "name": "electron-prebuilt", "version": "0.23.0", - "description": "Install atom-shell prebuilts using npm", + "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", - "url": "https://github.com/mafintosh/atom-shell" + "url": "https://github.com/mafintosh/electron" }, "scripts": { "install": "node install.js", "test": "tape test/*.js" }, "bin": { - "atom-shell": "run.bat" + "electron": "run.bat" }, "main": "index.js", "dependencies": { @@ -24,7 +24,7 @@ "author": "Mathias Buus", "license": "MIT", "bugs": { - "url": "https://github.com/mafintosh/atom-shell/issues" + "url": "https://github.com/mafintosh/electron-prebuilt/issues" }, - "homepage": "https://github.com/mafintosh/atom-shell" + "homepage": "https://github.com/mafintosh/electron-prebuilt" } diff --git a/npm/path.txt b/npm/path.txt new file mode 100644 index 000000000000..536ba521d6d3 --- /dev/null +++ b/npm/path.txt @@ -0,0 +1 @@ +/Users/maxogden/src/js/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron \ No newline at end of file diff --git a/npm/run.bat b/npm/run.bat old mode 100644 new mode 100755 index e69de29bb2d1..99b1e0874f08 --- a/npm/run.bat +++ b/npm/run.bat @@ -0,0 +1,2 @@ +#!/bin/bash +"/Users/maxogden/src/js/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron" "$@" \ No newline at end of file diff --git a/npm/test/index.js b/npm/test/index.js index ba59de191156..446a5445d7b6 100644 --- a/npm/test/index.js +++ b/npm/test/index.js @@ -1,8 +1,8 @@ var tape = require('tape') -var atom = require('../') +var electron = require('../') var fs = require('fs') tape('has binary', function(t) { - t.ok(fs.existsSync(atom), 'atom-shell was downloaded') + t.ok(fs.existsSync(electron), 'electron was downloaded') t.end() }) \ No newline at end of file From b365cdc28391ad8c3f4c9933a0466e7282f92aa9 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Fri, 17 Apr 2015 11:20:02 -0700 Subject: [PATCH 065/328] 0.24.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index fb8e95153776..66d183227ea2 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.23.0", + "version": "0.24.0", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From fa13ebf5024733dcbd19ef177db641c1bf3a3917 Mon Sep 17 00:00:00 2001 From: Steel Brain Date: Fri, 17 Apr 2015 11:30:44 -0700 Subject: [PATCH 066/328] :art: Fix a typo --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 66d183227ea2..e1c82c544bfb 100644 --- a/npm/package.json +++ b/npm/package.json @@ -4,7 +4,7 @@ "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", - "url": "https://github.com/mafintosh/electron" + "url": "https://github.com/mafintosh/electron-prebuilt" }, "scripts": { "install": "node install.js", From c973ebc84ae3c697532bf9677030566ec6684f6c Mon Sep 17 00:00:00 2001 From: James Kyburz Date: Thu, 23 Apr 2015 21:37:46 +0200 Subject: [PATCH 067/328] update electron version fixing windows issues --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index ad0201f227c4..344e86752d13 100755 --- a/npm/install.js +++ b/npm/install.js @@ -8,7 +8,7 @@ var fs = require('fs') var platform = os.platform() var arch = os.arch() -var version = '0.24.0' +var version = '0.25.1' var filename = 'electron-v' + version + '-' + platform + '-' + arch + '.zip' var url = 'https://github.com/atom/electron/releases/download/v' + version + '/electron-v' + version + '-' + platform + '-' + arch + '.zip' From 0b0472a999f6e1bb6a58ca4220603d5d6903058d Mon Sep 17 00:00:00 2001 From: James Kyburz Date: Thu, 23 Apr 2015 21:37:31 +0200 Subject: [PATCH 068/328] replaced run.bat with cli.js closes #9 --- npm/cli.js | 7 +++++++ npm/install.js | 13 ------------- npm/package.json | 2 +- npm/run.bat | 2 -- 4 files changed, 8 insertions(+), 16 deletions(-) create mode 100755 npm/cli.js delete mode 100755 npm/run.bat diff --git a/npm/cli.js b/npm/cli.js new file mode 100755 index 000000000000..895782f980a1 --- /dev/null +++ b/npm/cli.js @@ -0,0 +1,7 @@ +#!/usr/bin/env node + +var electron = require('./') + +var proc = require('child_process') + +proc.spawn(electron, process.argv.slice(2), {stdio: 'inherit'}); diff --git a/npm/install.js b/npm/install.js index 344e86752d13..3ab5ce3ab8f5 100755 --- a/npm/install.js +++ b/npm/install.js @@ -22,24 +22,11 @@ var paths = { win32: path.join(__dirname, './dist/electron.exe') } -var shebang = { - darwin: '#!/bin/bash\n', - linux: '#!/bin/bash\n', - win32: '' -} - -var argv = { - darwin: '"$@"', - linux: '"$@"', - win32: '%*' // does this work with " " in the args? -} - if (!paths[platform]) throw new Error('Unknown platform: ' + platform) nugget(url, {target: filename, dir: __dirname, resume: true, verbose: true}, function (err) { if (err) return onerror(err) fs.writeFileSync(path.join(__dirname, 'path.txt'), paths[platform]) - fs.writeFileSync(path.join(__dirname, 'run.bat'), shebang[platform] + '"' + paths[platform] + '" ' + argv[platform]) extract(path.join(__dirname, filename), {dir: path.join(__dirname, 'dist')}, function (err) { if (err) return onerror(err) }) diff --git a/npm/package.json b/npm/package.json index e1c82c544bfb..37c3053e69fe 100644 --- a/npm/package.json +++ b/npm/package.json @@ -11,7 +11,7 @@ "test": "tape test/*.js" }, "bin": { - "electron": "run.bat" + "electron": "cli.js" }, "main": "index.js", "dependencies": { diff --git a/npm/run.bat b/npm/run.bat deleted file mode 100755 index 99b1e0874f08..000000000000 --- a/npm/run.bat +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -"/Users/maxogden/src/js/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron" "$@" \ No newline at end of file From 230a17909cdba4cfcb41133125c0a148860b0c92 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sat, 25 Apr 2015 12:49:53 -0700 Subject: [PATCH 069/328] upgrade --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index ad0201f227c4..5188f97f0c06 100755 --- a/npm/install.js +++ b/npm/install.js @@ -8,7 +8,7 @@ var fs = require('fs') var platform = os.platform() var arch = os.arch() -var version = '0.24.0' +var version = '0.25.0' var filename = 'electron-v' + version + '-' + platform + '-' + arch + '.zip' var url = 'https://github.com/atom/electron/releases/download/v' + version + '/electron-v' + version + '-' + platform + '-' + arch + '.zip' From f70969be0f170e6545f7669fb9654a3b32f67fa7 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sat, 25 Apr 2015 12:49:56 -0700 Subject: [PATCH 070/328] 0.25.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index e1c82c544bfb..d2a29bb90590 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.24.0", + "version": "0.25.0", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From cfddeef6ba1855f54ae50b737812d73a6f89f06c Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sat, 25 Apr 2015 12:50:21 -0700 Subject: [PATCH 071/328] upgrade --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 5188f97f0c06..344e86752d13 100755 --- a/npm/install.js +++ b/npm/install.js @@ -8,7 +8,7 @@ var fs = require('fs') var platform = os.platform() var arch = os.arch() -var version = '0.25.0' +var version = '0.25.1' var filename = 'electron-v' + version + '-' + platform + '-' + arch + '.zip' var url = 'https://github.com/atom/electron/releases/download/v' + version + '/electron-v' + version + '-' + platform + '-' + arch + '.zip' From fad1fd663510f7878eb75095e82a46a5f6e6630e Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sat, 25 Apr 2015 12:50:23 -0700 Subject: [PATCH 072/328] 0.25.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index d2a29bb90590..80e722488f83 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.25.0", + "version": "0.25.1", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From a76d0acb2ed5f3639786e071dfebb415a9d2b0d5 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Thu, 30 Apr 2015 11:40:32 +0200 Subject: [PATCH 073/328] 0.25.1-1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 9c63456fa67a..db142d495498 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.25.1", + "version": "0.25.1-1", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 7b079a23b5ebc80865fdc4479a10543b1aeda6c8 Mon Sep 17 00:00:00 2001 From: "hemanth.hm" Date: Fri, 1 May 2015 15:10:01 +0530 Subject: [PATCH 074/328] version 0.25.2 We must pick this up from the repo itself. --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 3ab5ce3ab8f5..76626bbfe84a 100755 --- a/npm/install.js +++ b/npm/install.js @@ -8,7 +8,7 @@ var fs = require('fs') var platform = os.platform() var arch = os.arch() -var version = '0.25.1' +var version = '0.25.2' var filename = 'electron-v' + version + '-' + platform + '-' + arch + '.zip' var url = 'https://github.com/atom/electron/releases/download/v' + version + '/electron-v' + version + '-' + platform + '-' + arch + '.zip' From a6ac7c98ec5e90bffcfe2ba9c1e18390903e5248 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Sun, 3 May 2015 16:52:12 +0200 Subject: [PATCH 075/328] 0.25.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index db142d495498..93533be9d172 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.25.1-1", + "version": "0.25.2", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 3c8af7564b5b792c63f822f8a40408d012ac86ac Mon Sep 17 00:00:00 2001 From: RnbWd Date: Wed, 6 May 2015 17:50:49 -0700 Subject: [PATCH 076/328] fs.existsSync() is depreciated in io.js --- npm/test/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/npm/test/index.js b/npm/test/index.js index 446a5445d7b6..02dac6340c7b 100644 --- a/npm/test/index.js +++ b/npm/test/index.js @@ -1,8 +1,8 @@ var tape = require('tape') var electron = require('../') -var fs = require('fs') +var pathExists = require('path-exists') tape('has binary', function(t) { - t.ok(fs.existsSync(electron), 'electron was downloaded') + t.ok(pathExists.sync(electron), 'electron was downloaded') t.end() -}) \ No newline at end of file +}) From 9afad0a3d7a2ba8e3972781597067b6bcb7b2953 Mon Sep 17 00:00:00 2001 From: RnbWd Date: Wed, 6 May 2015 17:52:20 -0700 Subject: [PATCH 077/328] ignore path.txt --- npm/.gitignore | 3 ++- npm/package.json | 1 + npm/path.txt | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/npm/.gitignore b/npm/.gitignore index 8e1d95c3c414..07d41466bada 100644 --- a/npm/.gitignore +++ b/npm/.gitignore @@ -1,4 +1,5 @@ node_modules *.zip dist -.DS_Store \ No newline at end of file +path.txt +.DS_Store diff --git a/npm/package.json b/npm/package.json index 93533be9d172..531b3bfaa929 100644 --- a/npm/package.json +++ b/npm/package.json @@ -19,6 +19,7 @@ "nugget": "^1.2.0" }, "devDependencies": { + "path-exists": "^1.0.0", "tape": "^3.0.1" }, "author": "Mathias Buus", diff --git a/npm/path.txt b/npm/path.txt index 536ba521d6d3..630ae424ee9e 100644 --- a/npm/path.txt +++ b/npm/path.txt @@ -1 +1 @@ -/Users/maxogden/src/js/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron \ No newline at end of file +/Users/rnbwd/Projects/forks/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron \ No newline at end of file From 8fdb5b42d8939ca960f75651c57e095aaad2e67d Mon Sep 17 00:00:00 2001 From: RnbWd Date: Wed, 6 May 2015 17:52:51 -0700 Subject: [PATCH 078/328] update --- npm/path.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 npm/path.txt diff --git a/npm/path.txt b/npm/path.txt deleted file mode 100644 index 630ae424ee9e..000000000000 --- a/npm/path.txt +++ /dev/null @@ -1 +0,0 @@ -/Users/rnbwd/Projects/forks/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron \ No newline at end of file From 7864197291c0957f64f472f1671a1b8ae064b797 Mon Sep 17 00:00:00 2001 From: RnbWd Date: Wed, 6 May 2015 21:44:10 -0700 Subject: [PATCH 079/328] added cache --- npm/.travis.yml | 2 ++ npm/install.js | 26 ++++++++++++++++++++++---- npm/package.json | 10 +++++++--- npm/test/index.js | 9 ++++++++- 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/npm/.travis.yml b/npm/.travis.yml index 244b7e88e327..991d04b6e227 100644 --- a/npm/.travis.yml +++ b/npm/.travis.yml @@ -1,3 +1,5 @@ language: node_js node_js: - '0.10' + - '0.12' + - 'iojs' diff --git a/npm/install.js b/npm/install.js index 76626bbfe84a..bf4002ed6f0c 100755 --- a/npm/install.js +++ b/npm/install.js @@ -2,10 +2,12 @@ var os = require('os') var path = require('path') +var pathExists = require('path-exists') +var mkdir = require('mkdirp') var nugget = require('nugget') var extract = require('extract-zip') var fs = require('fs') - +var getHomePath = require('home-path')() var platform = os.platform() var arch = os.arch() var version = '0.25.2' @@ -22,12 +24,28 @@ var paths = { win32: path.join(__dirname, './dist/electron.exe') } +var cache = { + darwin: path.join(getHomePath, './.electron'), + linux: path.join(getHomePath, './.electron'), + win32: path.join(getHomePath, './.electron') +} + if (!paths[platform]) throw new Error('Unknown platform: ' + platform) -nugget(url, {target: filename, dir: __dirname, resume: true, verbose: true}, function (err) { +// use cache if possible +if (pathExists.sync(path.join(cache[platform], filename))) { + extractFile() +} else { + mkdir(cache[platform], function(err) { + if (err) return onerror(err) + nugget(url, {target: filename, dir: cache[platform], resume: true, verbose: true}, extractFile) + }) +} + +function extractFile (err) { if (err) return onerror(err) fs.writeFileSync(path.join(__dirname, 'path.txt'), paths[platform]) - extract(path.join(__dirname, filename), {dir: path.join(__dirname, 'dist')}, function (err) { + extract(path.join(cache[platform], filename), {dir: path.join(__dirname, 'dist')}, function (err) { if (err) return onerror(err) }) -}) +} diff --git a/npm/package.json b/npm/package.json index 531b3bfaa929..5bb1b9f7db9f 100644 --- a/npm/package.json +++ b/npm/package.json @@ -8,7 +8,8 @@ }, "scripts": { "install": "node install.js", - "test": "tape test/*.js" + "test": "tape test/*.js", + "cache-clean": "rimraf ~/.electron" }, "bin": { "electron": "cli.js" @@ -16,10 +17,13 @@ "main": "index.js", "dependencies": { "extract-zip": "^1.0.3", - "nugget": "^1.2.0" + "home-path": "^0.1.1", + "mkdirp": "^0.5.0", + "nugget": "^1.2.0", + "path-exists": "^1.0.0" }, "devDependencies": { - "path-exists": "^1.0.0", + "rimraf": "^2.3.3", "tape": "^3.0.1" }, "author": "Mathias Buus", diff --git a/npm/test/index.js b/npm/test/index.js index 02dac6340c7b..798a9377dc33 100644 --- a/npm/test/index.js +++ b/npm/test/index.js @@ -1,8 +1,15 @@ var tape = require('tape') var electron = require('../') +var path = require('path'); var pathExists = require('path-exists') +var getHomePath = require('home-path')() -tape('has binary', function(t) { +tape('has local binary', function(t) { t.ok(pathExists.sync(electron), 'electron was downloaded') t.end() }) + +tape('has cache folder', function(t) { + t.ok(pathExists.sync(path.join(getHomePath, './.electron')), 'cache exists') + t.end() +}) From ce8c95127e9b916eceba0cc546c1e1267398296b Mon Sep 17 00:00:00 2001 From: RnbWd Date: Thu, 7 May 2015 14:21:51 -0700 Subject: [PATCH 080/328] simplify cache paths --- npm/install.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/npm/install.js b/npm/install.js index bf4002ed6f0c..60795f3d841d 100755 --- a/npm/install.js +++ b/npm/install.js @@ -24,28 +24,24 @@ var paths = { win32: path.join(__dirname, './dist/electron.exe') } -var cache = { - darwin: path.join(getHomePath, './.electron'), - linux: path.join(getHomePath, './.electron'), - win32: path.join(getHomePath, './.electron') -} +var cache = path.join(getHomePath, './.electron') if (!paths[platform]) throw new Error('Unknown platform: ' + platform) // use cache if possible -if (pathExists.sync(path.join(cache[platform], filename))) { +if (pathExists.sync(path.join(cache, filename))) { extractFile() } else { - mkdir(cache[platform], function(err) { + mkdir(cache, function(err) { if (err) return onerror(err) - nugget(url, {target: filename, dir: cache[platform], resume: true, verbose: true}, extractFile) + nugget(url, {target: filename, dir: cache, resume: true, verbose: true}, extractFile) }) } function extractFile (err) { if (err) return onerror(err) fs.writeFileSync(path.join(__dirname, 'path.txt'), paths[platform]) - extract(path.join(cache[platform], filename), {dir: path.join(__dirname, 'dist')}, function (err) { + extract(path.join(cache, filename), {dir: path.join(__dirname, 'dist')}, function (err) { if (err) return onerror(err) }) } From bbdec2be1af2842b228bcc04a77fa83098aac8ae Mon Sep 17 00:00:00 2001 From: RnbWd Date: Fri, 8 May 2015 06:11:40 -0700 Subject: [PATCH 081/328] v0.25.3 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 60795f3d841d..6b3dc437afd7 100755 --- a/npm/install.js +++ b/npm/install.js @@ -10,7 +10,7 @@ var fs = require('fs') var getHomePath = require('home-path')() var platform = os.platform() var arch = os.arch() -var version = '0.25.2' +var version = '0.25.3' var filename = 'electron-v' + version + '-' + platform + '-' + arch + '.zip' var url = 'https://github.com/atom/electron/releases/download/v' + version + '/electron-v' + version + '-' + platform + '-' + arch + '.zip' From 0a8ac33911a543f75a386c3a5d0fd4566b0b9599 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Sat, 9 May 2015 00:13:31 +0200 Subject: [PATCH 082/328] reset version for #18 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 6b3dc437afd7..60795f3d841d 100755 --- a/npm/install.js +++ b/npm/install.js @@ -10,7 +10,7 @@ var fs = require('fs') var getHomePath = require('home-path')() var platform = os.platform() var arch = os.arch() -var version = '0.25.3' +var version = '0.25.2' var filename = 'electron-v' + version + '-' + platform + '-' + arch + '.zip' var url = 'https://github.com/atom/electron/releases/download/v' + version + '/electron-v' + version + '-' + platform + '-' + arch + '.zip' From 2e4881ba68494953f46018e1764f741291158760 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Sat, 9 May 2015 00:13:41 +0200 Subject: [PATCH 083/328] 0.25.2-1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 5bb1b9f7db9f..e8d5727c0581 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.25.2", + "version": "0.25.2-1", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 0ba1f030a3c330e3660f373f75d89595a7a7e5b6 Mon Sep 17 00:00:00 2001 From: Misumi Rize Date: Fri, 8 May 2015 19:31:29 +0900 Subject: [PATCH 084/328] version 0.25.3 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 60795f3d841d..6b3dc437afd7 100755 --- a/npm/install.js +++ b/npm/install.js @@ -10,7 +10,7 @@ var fs = require('fs') var getHomePath = require('home-path')() var platform = os.platform() var arch = os.arch() -var version = '0.25.2' +var version = '0.25.3' var filename = 'electron-v' + version + '-' + platform + '-' + arch + '.zip' var url = 'https://github.com/atom/electron/releases/download/v' + version + '/electron-v' + version + '-' + platform + '-' + arch + '.zip' From 92a2eb2864eb4aca4c57235d4bc405e7257a4395 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Sat, 9 May 2015 00:19:09 +0200 Subject: [PATCH 085/328] 0.25.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index e8d5727c0581..78f5dca9bd2f 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.25.2-1", + "version": "0.25.3", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From e2fc1a0fb1bbcfb34e44492ab5646da21bbe2a5b Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sun, 10 May 2015 13:54:06 -0700 Subject: [PATCH 086/328] refactor to use electron-download --- npm/install.js | 37 ++++++++++++++----------------------- npm/package.json | 6 +----- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/npm/install.js b/npm/install.js index 6b3dc437afd7..b3994b64e434 100755 --- a/npm/install.js +++ b/npm/install.js @@ -1,18 +1,15 @@ #!/usr/bin/env node +// maintainer note - update this manually when doing new releases: +var version = '0.25.3' + +var fs = require('fs') var os = require('os') var path = require('path') -var pathExists = require('path-exists') -var mkdir = require('mkdirp') -var nugget = require('nugget') var extract = require('extract-zip') -var fs = require('fs') -var getHomePath = require('home-path')() +var download = require('electron-download') + var platform = os.platform() -var arch = os.arch() -var version = '0.25.3' -var filename = 'electron-v' + version + '-' + platform + '-' + arch + '.zip' -var url = 'https://github.com/atom/electron/releases/download/v' + version + '/electron-v' + version + '-' + platform + '-' + arch + '.zip' function onerror (err) { throw err @@ -24,24 +21,18 @@ var paths = { win32: path.join(__dirname, './dist/electron.exe') } -var cache = path.join(getHomePath, './.electron') - if (!paths[platform]) throw new Error('Unknown platform: ' + platform) -// use cache if possible -if (pathExists.sync(path.join(cache, filename))) { - extractFile() -} else { - mkdir(cache, function(err) { - if (err) return onerror(err) - nugget(url, {target: filename, dir: cache, resume: true, verbose: true}, extractFile) - }) -} +// downloads if not cached +download({version: version}, extractFile) -function extractFile (err) { +// unzips and makes path.txt point at the correct executable +function extractFile (err, zipPath) { if (err) return onerror(err) - fs.writeFileSync(path.join(__dirname, 'path.txt'), paths[platform]) - extract(path.join(cache, filename), {dir: path.join(__dirname, 'dist')}, function (err) { + fs.writeFile(path.join(__dirname, 'path.txt'), paths[platform], function (err) { if (err) return onerror(err) + extract(zipPath, {dir: path.join(__dirname, 'dist')}, function (err) { + if (err) return onerror(err) + }) }) } diff --git a/npm/package.json b/npm/package.json index 78f5dca9bd2f..cf9dc8f68b33 100644 --- a/npm/package.json +++ b/npm/package.json @@ -17,13 +17,9 @@ "main": "index.js", "dependencies": { "extract-zip": "^1.0.3", - "home-path": "^0.1.1", - "mkdirp": "^0.5.0", - "nugget": "^1.2.0", - "path-exists": "^1.0.0" + "electron-download": "^1.0.0" }, "devDependencies": { - "rimraf": "^2.3.3", "tape": "^3.0.1" }, "author": "Mathias Buus", From 009925d0fb912195c8ca44b8c3d80ede4ca62f28 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sun, 10 May 2015 13:54:36 -0700 Subject: [PATCH 087/328] 0.25.3-1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index cf9dc8f68b33..d8fa3dc4243e 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.25.3", + "version": "0.25.3-1", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From baae0583c91d99bb343ec202adb85664fe9cc25d Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sun, 10 May 2015 13:55:44 -0700 Subject: [PATCH 088/328] 0.25.3-2 - add missing devDeps for tests --- npm/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index d8fa3dc4243e..b182c382691b 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.25.3-1", + "version": "0.25.3-2", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", @@ -20,6 +20,8 @@ "electron-download": "^1.0.0" }, "devDependencies": { + "home-path": "^0.1.1", + "path-exists": "^1.0.0", "tape": "^3.0.1" }, "author": "Mathias Buus", From eeb0d4439eff08e18e78a1502fa4a9f8a5100a3b Mon Sep 17 00:00:00 2001 From: RnbWd Date: Tue, 12 May 2015 16:10:22 -0700 Subject: [PATCH 089/328] updated scripts / .ignores --- npm/.gitignore | 1 - npm/.npmignore | 2 ++ npm/package.json | 7 ++++--- 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 npm/.npmignore diff --git a/npm/.gitignore b/npm/.gitignore index 07d41466bada..9ec0c37f1d7a 100644 --- a/npm/.gitignore +++ b/npm/.gitignore @@ -1,5 +1,4 @@ node_modules -*.zip dist path.txt .DS_Store diff --git a/npm/.npmignore b/npm/.npmignore new file mode 100644 index 000000000000..fe67adfa7c33 --- /dev/null +++ b/npm/.npmignore @@ -0,0 +1,2 @@ +dist/ +path.txt diff --git a/npm/package.json b/npm/package.json index b182c382691b..e190cf7782a1 100644 --- a/npm/package.json +++ b/npm/package.json @@ -7,9 +7,10 @@ "url": "https://github.com/mafintosh/electron-prebuilt" }, "scripts": { - "install": "node install.js", - "test": "tape test/*.js", - "cache-clean": "rimraf ~/.electron" + "cache-clean": "rm -rf ~/.electron && rm -rf dist", + "postinstall": "node install.js", + "pretest": "npm run cache-clean && node install.js", + "test": "tape test/*.js" }, "bin": { "electron": "cli.js" From 19c6a6195d0f34435d555a13785e4e84ba2d5043 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Tue, 12 May 2015 17:22:05 -0700 Subject: [PATCH 090/328] 0.26.0 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index b3994b64e434..eae07716402c 100755 --- a/npm/install.js +++ b/npm/install.js @@ -1,7 +1,7 @@ #!/usr/bin/env node // maintainer note - update this manually when doing new releases: -var version = '0.25.3' +var version = '0.26.0' var fs = require('fs') var os = require('os') From bd2b0f2c2f02f439e88048c7cbf810c1d7de376f Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Tue, 12 May 2015 17:22:08 -0700 Subject: [PATCH 091/328] 0.26.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index b182c382691b..bc318ed84347 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.25.3-2", + "version": "0.26.0", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 458a4f95ff0735b416a0e2154311ccd52665e8f7 Mon Sep 17 00:00:00 2001 From: Ingo Richter Date: Thu, 21 May 2015 18:21:22 -0700 Subject: [PATCH 092/328] - update electron shell to 0.26.1 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index eae07716402c..135098c97e25 100755 --- a/npm/install.js +++ b/npm/install.js @@ -1,7 +1,7 @@ #!/usr/bin/env node // maintainer note - update this manually when doing new releases: -var version = '0.26.0' +var version = '0.26.1' var fs = require('fs') var os = require('os') From 38f0c02ea14468402f1b38d6909b4f59d83c3f6b Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Thu, 21 May 2015 20:15:58 -0700 Subject: [PATCH 093/328] 0.26.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index e31ed6520dbf..0c99ab8f84df 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.26.0", + "version": "0.26.1", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 2cd0ee5321ad73299ea8be4ec8922c1b5ff82ae3 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Thu, 28 May 2015 11:16:44 -0700 Subject: [PATCH 094/328] 0.27.0 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 135098c97e25..b4e1dd886726 100755 --- a/npm/install.js +++ b/npm/install.js @@ -1,7 +1,7 @@ #!/usr/bin/env node // maintainer note - update this manually when doing new releases: -var version = '0.26.1' +var version = '0.27.0' var fs = require('fs') var os = require('os') From 834e181a388fda20cba143ae52a12fedbfa70d99 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Thu, 28 May 2015 11:16:46 -0700 Subject: [PATCH 095/328] 0.27.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 0c99ab8f84df..e56c960bfe83 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.26.1", + "version": "0.27.0", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 1d8a289ed29e3fe2076bd397338ffca4619e52d8 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Thu, 28 May 2015 11:17:04 -0700 Subject: [PATCH 096/328] 0.27.1 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index b4e1dd886726..87d00185d92b 100755 --- a/npm/install.js +++ b/npm/install.js @@ -1,7 +1,7 @@ #!/usr/bin/env node // maintainer note - update this manually when doing new releases: -var version = '0.27.0' +var version = '0.27.1' var fs = require('fs') var os = require('os') From afc89ce2e90beac23336988b078a88744679d859 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Thu, 28 May 2015 11:17:07 -0700 Subject: [PATCH 097/328] 0.27.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index e56c960bfe83..1a64a66ba33c 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.27.0", + "version": "0.27.1", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 740849270c88647398f630481e2a10b2e18c4993 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Mon, 1 Jun 2015 15:38:17 -0700 Subject: [PATCH 098/328] 0.27.2 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 87d00185d92b..47224325f2d8 100755 --- a/npm/install.js +++ b/npm/install.js @@ -1,7 +1,7 @@ #!/usr/bin/env node // maintainer note - update this manually when doing new releases: -var version = '0.27.1' +var version = '0.27.2' var fs = require('fs') var os = require('os') From df1ee48faabe628c8fd503c6102b3a3a58538c1d Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Mon, 1 Jun 2015 15:38:24 -0700 Subject: [PATCH 099/328] 0.27.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 1a64a66ba33c..53808fef777e 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.27.1", + "version": "0.27.2", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 811935b3b249f0c7da7ceee50ecdd35ab446250f Mon Sep 17 00:00:00 2001 From: Matt DesLauriers Date: Tue, 9 Jun 2015 10:42:26 -0400 Subject: [PATCH 100/328] bump to 0.27.3 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 47224325f2d8..53cf9a663879 100755 --- a/npm/install.js +++ b/npm/install.js @@ -1,7 +1,7 @@ #!/usr/bin/env node // maintainer note - update this manually when doing new releases: -var version = '0.27.2' +var version = '0.27.3' var fs = require('fs') var os = require('os') From 0a93f3691c878a0999e1929edcb1bf168c9ea2d9 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Tue, 9 Jun 2015 11:13:40 -0700 Subject: [PATCH 101/328] 0.27.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 53808fef777e..37300840e584 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.27.2", + "version": "0.27.3", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From efd51295c9fc1e7fa8f01eaa564ded128c38098f Mon Sep 17 00:00:00 2001 From: Lars-Magnus Skog Date: Tue, 9 Jun 2015 18:48:09 +0200 Subject: [PATCH 102/328] use version from package.json --- npm/install.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/install.js b/npm/install.js index 53cf9a663879..3261c6958ac1 100755 --- a/npm/install.js +++ b/npm/install.js @@ -1,7 +1,7 @@ #!/usr/bin/env node -// maintainer note - update this manually when doing new releases: -var version = '0.27.3' +// maintainer note - x.y.z-ab version in package.json -> x.y.z +var version = require('./package').version.replace(/-.*/, '') var fs = require('fs') var os = require('os') From a58788822cdae781b1becd6ca144277e3026ca2a Mon Sep 17 00:00:00 2001 From: Martin Samson Date: Fri, 12 Jun 2015 12:02:07 -0400 Subject: [PATCH 103/328] Updated to 0.28.1 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 53cf9a663879..cceb2824e6b3 100755 --- a/npm/install.js +++ b/npm/install.js @@ -1,7 +1,7 @@ #!/usr/bin/env node // maintainer note - update this manually when doing new releases: -var version = '0.27.3' +var version = '0.28.1' var fs = require('fs') var os = require('os') From cf7b55262533a617192ab9bdf5f36c16685fb55c Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Mon, 15 Jun 2015 09:37:33 -0700 Subject: [PATCH 104/328] 0.28.0 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index cceb2824e6b3..8fe5ba329113 100755 --- a/npm/install.js +++ b/npm/install.js @@ -1,7 +1,7 @@ #!/usr/bin/env node // maintainer note - update this manually when doing new releases: -var version = '0.28.1' +var version = '0.28.0' var fs = require('fs') var os = require('os') From df8d88916bb18c91998e33fff4d151ce1cd50dc3 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Mon, 15 Jun 2015 09:37:36 -0700 Subject: [PATCH 105/328] 0.28.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 37300840e584..e757c2b9f5a5 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.27.3", + "version": "0.28.0", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 27066795898e54edb3e1561c0ffcdd7531602d2c Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Mon, 15 Jun 2015 09:38:01 -0700 Subject: [PATCH 106/328] 0.28.1 --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 8fe5ba329113..cceb2824e6b3 100755 --- a/npm/install.js +++ b/npm/install.js @@ -1,7 +1,7 @@ #!/usr/bin/env node // maintainer note - update this manually when doing new releases: -var version = '0.28.0' +var version = '0.28.1' var fs = require('fs') var os = require('os') From b9fa0fdbe2807893688fcfb1099c6239f840536e Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Mon, 15 Jun 2015 09:38:04 -0700 Subject: [PATCH 107/328] 0.28.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index e757c2b9f5a5..b66e97a01beb 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.28.0", + "version": "0.28.1", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 56270a505d779c681b6c37c5d645698480cde4fa Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Wed, 17 Jun 2015 20:52:37 -0700 Subject: [PATCH 108/328] document proxy env vars. closes #21 --- npm/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/npm/README.md b/npm/README.md index 07252a254fb2..a895505d476c 100644 --- a/npm/README.md +++ b/npm/README.md @@ -36,6 +36,8 @@ Now you can just run `electron` to run electron: electron ``` +If you need to use an HTTP proxy you can [set these environment variables](https://github.com/request/request/tree/f0c4ec061141051988d1216c24936ad2e7d5c45d#controlling-proxy-behaviour-using-environment-variables) + ## Usage First you have to [write an electron application](https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md) From e43c524ca46419989ea52535d8856475e5064658 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 18 Jun 2015 05:48:49 +0000 Subject: [PATCH 109/328] Update to Electron v0.28.2 --- npm/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/package.json b/npm/package.json index b66e97a01beb..85c272b5c958 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.28.1", + "version": "0.28.2", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", @@ -31,4 +31,4 @@ "url": "https://github.com/mafintosh/electron-prebuilt/issues" }, "homepage": "https://github.com/mafintosh/electron-prebuilt" -} +} \ No newline at end of file From 4e6381056a2b4587549e0f97b3849d62e5534e80 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Tue, 23 Jun 2015 07:40:05 +0000 Subject: [PATCH 110/328] Update to Electron v0.28.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 85c272b5c958..9aed87dfd986 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.28.2", + "version": "0.28.3", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 5fb9c596b2fa109650100dd949b91ede2518c271 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 3 Jul 2015 04:16:28 -0700 Subject: [PATCH 111/328] Update to Electron v0.29.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 9aed87dfd986..a2165dc77e61 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.28.3", + "version": "0.29.0", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 52c92032d20cf7737338c03a16ec3f1e2ba845c5 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 3 Jul 2015 09:21:10 -0700 Subject: [PATCH 112/328] Update to Electron v0.29.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index a2165dc77e61..800beec9ae4d 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.29.0", + "version": "0.29.1", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From bd94d8028db352e7183a564318c94c4fe6b32577 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Tue, 7 Jul 2015 03:06:55 -0700 Subject: [PATCH 113/328] Update to Electron v0.29.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 800beec9ae4d..7d07c226f4b2 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.29.1", + "version": "0.29.2", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From c2e552de028669b0916365bd5d22368acdd6b83b Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 16 Jul 2015 10:56:17 -0700 Subject: [PATCH 114/328] Update to Electron v0.30.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 7d07c226f4b2..96813f48a076 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.29.2", + "version": "0.30.0", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 9daed3990795dd3267e640fa9d00cb68542e55bc Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 24 Jul 2015 03:36:37 -0700 Subject: [PATCH 115/328] Update to Electron v0.30.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 96813f48a076..41646756754e 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.30.0", + "version": "0.30.1", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 33d63ac7128a51dd63b65ccbc34b1546e7a3032b Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Wed, 29 Jul 2015 15:39:15 -0700 Subject: [PATCH 116/328] update readme --- npm/README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/npm/README.md b/npm/README.md index a895505d476c..a78dad2100d7 100644 --- a/npm/README.md +++ b/npm/README.md @@ -1,12 +1,13 @@ # electron-prebuilt [![build status](http://img.shields.io/travis/mafintosh/electron-prebuilt.svg?style=flat)](http://travis-ci.org/mafintosh/electron-prebuilt) +[![dat](http://img.shields.io/badge/Development%20sponsored%20by-dat-green.svg?style=flat)](http://dat-data.com/) -Install [electron](https://github.com/atom/electron) (formerly called **atom-shell**) prebuilt binaries for command-line use using npm. +Install [electron](https://github.com/atom/electron) prebuilt binaries for command-line use using npm. This module helps you easily install the `electron` command for use on the command line without having to compile anything. Works on Mac, Windows and Linux OSes that Electron supports (e.g. Electron [does not support Windows XP](https://github.com/atom/electron/issues/691)). -Electron is a javascript runtime that bundles Node.js and Chromium. You use it similar to the `node` command on the command line for executing javascript programs. This module helps you easily install the `electron` command for use on the command line without having to compile anything. +Electron is a JavaScript runtime that bundles Node.js and Chromium. You use it similar to the `node` command on the command line for executing JavaScript programs. For more info you can read [this intro blog post](http://maxogden.com/electron-fundamentals.html) or dive into the [Electron documentation](https://github.com/atom/electron/tree/master/docs) ## Installation @@ -50,8 +51,8 @@ electron your-app/ ## Programmatic usage -If you require `electron-prebuilt` inside your node app it will return the file path to the binary. -Use this to spawn electron +Most people use this from the command line, but if you require `electron-prebuilt` inside your node app it will return the file path to the binary. +Use this to spawn electron from node scripts. ``` js var electron = require('electron-prebuilt') From 5252079b3b92e71ff9228d9ef5727651fe3d6009 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Wed, 29 Jul 2015 23:57:13 -0700 Subject: [PATCH 117/328] Update to Electron v0.30.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 41646756754e..cae6bd9c3730 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.30.1", + "version": "0.30.2", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 57f7250a8219e2d1b1f0e67deb443378701c2c6f Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 7 Aug 2015 16:48:07 +0200 Subject: [PATCH 118/328] Update to Electron v0.30.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index cae6bd9c3730..f5ba1f3a54ae 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.30.2", + "version": "0.30.3", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 0a281df10b0113295d6478e953d9c557e3cbb686 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Mon, 10 Aug 2015 17:36:15 +0200 Subject: [PATCH 119/328] Update to Electron v0.30.4 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index f5ba1f3a54ae..4ff7299819fc 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.30.3", + "version": "0.30.4", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From d752ffeb063159aa421e60299cbeeb5722610b9a Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 21 Aug 2015 07:51:02 +0200 Subject: [PATCH 120/328] Update to Electron v0.30.5 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 4ff7299819fc..b87552953807 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.30.4", + "version": "0.30.5", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From a3cdead9a8cc3104e0cbb069f278680fc8f42b97 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 21 Aug 2015 15:07:45 +0200 Subject: [PATCH 121/328] Update to Electron v0.31.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index b87552953807..791fe0e97ed6 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.30.5", + "version": "0.31.0", "description": "Install electron (formerly called atom-shell) prebuilts using npm", "repository": { "type": "git", From 2e0c44a91fc0523dddc04f2a41ae27e4804a4c9e Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sat, 22 Aug 2015 13:14:26 +0200 Subject: [PATCH 122/328] update docs and readme --- npm/CONTRIBUTING.md | 2 ++ npm/LICENSE | 7 +++++++ npm/README.md | 20 ++++++++++++++++++-- npm/package.json | 2 +- 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 npm/LICENSE diff --git a/npm/CONTRIBUTING.md b/npm/CONTRIBUTING.md index 97cd1958d524..c24021566105 100644 --- a/npm/CONTRIBUTING.md +++ b/npm/CONTRIBUTING.md @@ -1,3 +1,5 @@ +releases for this module are handled by https://github.com/johnmuhl/electron-prebuilt-updater + versions published to npm should match the versions published to [github releases for electron](https://github.com/atom/electron/releases) coding style should be `standard`: diff --git a/npm/LICENSE b/npm/LICENSE new file mode 100644 index 000000000000..5e3984a8fbf8 --- /dev/null +++ b/npm/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2015 Mathias Buus-Madsen, Max Ogden and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/npm/README.md b/npm/README.md index a78dad2100d7..8d23ff6e78a4 100644 --- a/npm/README.md +++ b/npm/README.md @@ -3,9 +3,9 @@ [![build status](http://img.shields.io/travis/mafintosh/electron-prebuilt.svg?style=flat)](http://travis-ci.org/mafintosh/electron-prebuilt) [![dat](http://img.shields.io/badge/Development%20sponsored%20by-dat-green.svg?style=flat)](http://dat-data.com/) -Install [electron](https://github.com/atom/electron) prebuilt binaries for command-line use using npm. This module helps you easily install the `electron` command for use on the command line without having to compile anything. +![badge](https://nodei.co/npm/electron-prebuilt.png?downloads=true) -Works on Mac, Windows and Linux OSes that Electron supports (e.g. Electron [does not support Windows XP](https://github.com/atom/electron/issues/691)). +Install [electron](https://github.com/atom/electron) prebuilt binaries for command-line use using npm. This module helps you easily install the `electron` command for use on the command line without having to compile anything. Electron is a JavaScript runtime that bundles Node.js and Chromium. You use it similar to the `node` command on the command line for executing JavaScript programs. For more info you can read [this intro blog post](http://maxogden.com/electron-fundamentals.html) or dive into the [Electron documentation](https://github.com/atom/electron/tree/master/docs) @@ -39,6 +39,14 @@ electron If you need to use an HTTP proxy you can [set these environment variables](https://github.com/request/request/tree/f0c4ec061141051988d1216c24936ad2e7d5c45d#controlling-proxy-behaviour-using-environment-variables) +## About + +Works on Mac, Windows and Linux OSes that Electron supports (e.g. Electron [does not support Windows XP](https://github.com/atom/electron/issues/691)). + +The version numbers of this module match the version number of the [offical Electron releases](https://github.com/atom/electron/releases), which do not follow [semantic versioning](http://semver.org/). + +This module is automatically released whenever a new version of Electron is released thanks to [electron-prebuilt-updater](https://github.com/johnmuhl/electron-prebuilt-updater) written by [John Muhl](https://github.com/johnmuhl/). + ## Usage First you have to [write an electron application](https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md) @@ -49,6 +57,14 @@ Then you can run your app using: electron your-app/ ``` +## Related modules + +- [electron-packager](https://github.com/maxogden/electron-packager) - package and distribute your electron app in OS executables (.app, .exe etc) +- [electron-builder](https://github.com/loopline-systems/electron-builder) - create installers for Windows and OS X. It's built to work together with electron-packager +- [menubar](https://github.com/maxogden/menubar) - high level way to create menubar desktop applications with electron + +Find more at the [awesome-electron](https://github.com/sindresorhus/awesome-electron) list + ## Programmatic usage Most people use this from the command line, but if you require `electron-prebuilt` inside your node app it will return the file path to the binary. diff --git a/npm/package.json b/npm/package.json index 791fe0e97ed6..44a9814821f2 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,7 +1,7 @@ { "name": "electron-prebuilt", "version": "0.31.0", - "description": "Install electron (formerly called atom-shell) prebuilts using npm", + "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", "url": "https://github.com/mafintosh/electron-prebuilt" From 06d41a52305d4c2acab382b5e61d5e3c94c7d1c8 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Tue, 25 Aug 2015 21:22:37 -0700 Subject: [PATCH 123/328] Update to Electron v0.31.0 From c2a88b7996b8c2d8ca8e698092770a8ca038bc4b Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Wed, 26 Aug 2015 01:39:58 -0700 Subject: [PATCH 124/328] Update to Electron v0.30.6 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 44a9814821f2..a1c376bd6c11 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.31.0", + "version": "0.30.6", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 19109b2c51373520d72c5b39b97bb1e3c6bdd1dc Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Wed, 26 Aug 2015 02:29:27 -0700 Subject: [PATCH 125/328] Update to Electron v0.30.6 From 1dcb6096222997198b6758f0896beaa29f232128 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 27 Aug 2015 22:57:33 -0700 Subject: [PATCH 126/328] Update to Electron v0.31.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index a1c376bd6c11..5ef7bcfa6ded 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.30.6", + "version": "0.31.1", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From b23b1eb0f0b18280341f46e87ffbceb5768efa7b Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Tue, 1 Sep 2015 23:12:43 -0700 Subject: [PATCH 127/328] Update to Electron v0.31.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 5ef7bcfa6ded..029581dadf5f 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.31.1", + "version": "0.31.2", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From a3109ed01116bfb8783f626be85f837253a6364d Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Tue, 8 Sep 2015 22:06:20 -0700 Subject: [PATCH 128/328] Update to Electron v0.32.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 029581dadf5f..629efc45ee63 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.31.2", + "version": "0.32.0", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 4c4b2f44e79d5444e54c5d772960291e621e4d9d Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Wed, 9 Sep 2015 05:26:36 -0700 Subject: [PATCH 129/328] Update to Electron v0.32.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 629efc45ee63..47d20523c40b 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.32.0", + "version": "0.32.1", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 7749e9a8084a2a36dfca5bfbc9b19ee6667ed305 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 10 Sep 2015 06:22:19 -0700 Subject: [PATCH 130/328] Update to Electron v0.32.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 47d20523c40b..504069fc3d3d 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.32.1", + "version": "0.32.2", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 5d4dd00c41b2961fc25427f0c9bb6f3457b3cb12 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Tue, 15 Sep 2015 01:27:32 -0700 Subject: [PATCH 131/328] Update to Electron v0.32.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 504069fc3d3d..a8b7bbeb543b 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.32.2", + "version": "0.32.3", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 0b06748d9b57183b40dfbf9676eac68fd920349c Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 17 Sep 2015 04:39:21 -0700 Subject: [PATCH 132/328] Update to Electron v0.33.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index a8b7bbeb543b..dff603df35e2 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.32.3", + "version": "0.33.0", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From b3af5a94752edf5ba6b8f0a5612fc81e99793623 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Tue, 22 Sep 2015 01:03:54 -0700 Subject: [PATCH 133/328] Update to Electron v0.33.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index dff603df35e2..7d8bd8da1535 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.33.0", + "version": "0.33.1", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From f1f061e1e3d5176e2ba3a88cbc4c04d3d48a6156 Mon Sep 17 00:00:00 2001 From: Attila Sukosd Date: Fri, 28 Aug 2015 09:31:55 +0200 Subject: [PATCH 134/328] Added target arch support Previously electron-prebuilt would download the prebuilt binaries for the architecture native to the platform. However there are cases where being able to download for another architecture is favourable. This patch adds support for setting the architecture through npm's --arch= parameter. (Issue #53) --- npm/install.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/npm/install.js b/npm/install.js index 3261c6958ac1..fac56ae5fab9 100755 --- a/npm/install.js +++ b/npm/install.js @@ -23,8 +23,11 @@ var paths = { if (!paths[platform]) throw new Error('Unknown platform: ' + platform) -// downloads if not cached -download({version: version}, extractFile) +if (process.env.npm_config_arch) { + download({version: version, arch: process.env.npm_config_arch}, extractFile) +} else { + download({version: version}, extractFile) +} // unzips and makes path.txt point at the correct executable function extractFile (err, zipPath) { From dd59736393ea4e477af4a6f4921e83270b98a69d Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 22 Sep 2015 10:34:52 -0700 Subject: [PATCH 135/328] Clean up target arch support based on pull request #55 comments. --- npm/README.md | 5 +++++ npm/install.js | 7 ++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/npm/README.md b/npm/README.md index 8d23ff6e78a4..c40ed94a1859 100644 --- a/npm/README.md +++ b/npm/README.md @@ -39,6 +39,11 @@ electron If you need to use an HTTP proxy you can [set these environment variables](https://github.com/request/request/tree/f0c4ec061141051988d1216c24936ad2e7d5c45d#controlling-proxy-behaviour-using-environment-variables) +If you want to change the architecture that is downloaded (e.g., `ia32` on an `x64` machine), you can use the `--arch` flag with npm install or set the `npm_config_arch` environment variable: +``` +npm install --arch=ia32 electron-prebuilt +``` + ## About Works on Mac, Windows and Linux OSes that Electron supports (e.g. Electron [does not support Windows XP](https://github.com/atom/electron/issues/691)). diff --git a/npm/install.js b/npm/install.js index fac56ae5fab9..034153b60566 100755 --- a/npm/install.js +++ b/npm/install.js @@ -23,11 +23,8 @@ var paths = { if (!paths[platform]) throw new Error('Unknown platform: ' + platform) -if (process.env.npm_config_arch) { - download({version: version, arch: process.env.npm_config_arch}, extractFile) -} else { - download({version: version}, extractFile) -} +// downloads if not cached +download({version: version, arch: process.env.npm_config_arch}, extractFile) // unzips and makes path.txt point at the correct executable function extractFile (err, zipPath) { From 8b79453b504f72c4e4312d068f49d2a7fcba8892 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 24 Sep 2015 00:23:47 -0700 Subject: [PATCH 136/328] Update to Electron v0.30.7 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 7d8bd8da1535..889e7abea456 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.33.1", + "version": "0.30.7", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 31bce2281baea2471b12e30516dd0f24b5bd56a6 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 25 Sep 2015 05:32:43 -0700 Subject: [PATCH 137/328] Update to Electron v0.33.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 889e7abea456..6b9499634884 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.30.7", + "version": "0.33.2", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 3dff092a6efb87de2f9c8d5ffc7cb98eef3e326f Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Sat, 26 Sep 2015 07:04:26 -0700 Subject: [PATCH 138/328] Update to Electron v0.30.8 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 6b9499634884..6c8557d06cd6 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.33.2", + "version": "0.30.8", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 1631b9e231e72e96cabd403a09ec9e148f647d93 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Sat, 26 Sep 2015 07:39:23 -0700 Subject: [PATCH 139/328] Update to Electron v0.33.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 6c8557d06cd6..c8c8465a9f38 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.30.8", + "version": "0.33.3", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From f0a0fe116daf2f11c95232d64a067e775a94766d Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 1 Oct 2015 23:14:53 -0700 Subject: [PATCH 140/328] Update to Electron v0.33.4 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index c8c8465a9f38..ca89febdf426 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.33.3", + "version": "0.33.4", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 96263ea914fede99db674bc77e76f61ab9df5cc2 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Sun, 4 Oct 2015 21:46:52 -0700 Subject: [PATCH 141/328] Update to Electron v0.33.5 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index ca89febdf426..4fb4b2eb3509 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.33.4", + "version": "0.33.5", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 0b267d3fa635d22004c9de28334c835a78f5ff5d Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Mon, 5 Oct 2015 06:13:31 -0700 Subject: [PATCH 142/328] Update to Electron v0.33.6 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 4fb4b2eb3509..3508768584db 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.33.5", + "version": "0.33.6", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 02f5fabd6cb61a4690995802855ca3113d262011 Mon Sep 17 00:00:00 2001 From: Amos Wenger Date: Tue, 6 Oct 2015 22:45:12 +0200 Subject: [PATCH 143/328] Relay electron exit code --- npm/cli.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/npm/cli.js b/npm/cli.js index 895782f980a1..70ce710e0aee 100755 --- a/npm/cli.js +++ b/npm/cli.js @@ -4,4 +4,7 @@ var electron = require('./') var proc = require('child_process') -proc.spawn(electron, process.argv.slice(2), {stdio: 'inherit'}); +var child = proc.spawn(electron, process.argv.slice(2), {stdio: 'inherit'}); +child.on('close', function (code) { + process.exit(code); +}) From b5d84cbd74fe525b6a1d94a3d6144a43f38e80c6 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Sat, 10 Oct 2015 04:15:59 -0700 Subject: [PATCH 144/328] Update to Electron v0.33.7 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 3508768584db..3816ad47a212 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.33.6", + "version": "0.33.7", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From c3c5c65de3f8a9d7de554753c81a7b8893c94510 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Tue, 13 Oct 2015 22:23:50 -0700 Subject: [PATCH 145/328] Update to Electron v0.33.8 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 3816ad47a212..0b5cd8b62041 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.33.7", + "version": "0.33.8", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From cad5d6c24523e59c8137528faa54d4e05cc1fd63 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 16 Oct 2015 03:36:54 -0700 Subject: [PATCH 146/328] Update to Electron v0.33.9 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 0b5cd8b62041..2b84442068f8 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.33.8", + "version": "0.33.9", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 136ac2dae76e729bf9ae34418d9574ed292280ae Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 16 Oct 2015 05:16:38 -0700 Subject: [PATCH 147/328] Update to Electron v0.34.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 2b84442068f8..7c92c6e8827b 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.33.9", + "version": "0.34.0", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 7436910324110bbbffaca772ab9f5970e43098cc Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 23 Oct 2015 06:52:35 -0700 Subject: [PATCH 148/328] Update to Electron v0.34.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 7c92c6e8827b..f70a086e7f13 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.34.0", + "version": "0.34.1", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From ca2498ff2533fdc17b19942b1122df8e17f1d441 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 30 Oct 2015 00:33:56 -0700 Subject: [PATCH 149/328] Update to Electron v0.34.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index f70a086e7f13..ad22e45b2175 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.34.1", + "version": "0.34.2", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 2b289bb758e0e096d4ed8e6ea49e4ae818606f17 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 6 Nov 2015 07:56:36 -0800 Subject: [PATCH 150/328] Update to Electron v0.34.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index ad22e45b2175..3c59fc4508f2 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.34.2", + "version": "0.34.3", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 23b0e7679a3238f123443117711f63c064720cbc Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Mon, 16 Nov 2015 03:08:23 -0800 Subject: [PATCH 151/328] Update to Electron v0.35.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 3c59fc4508f2..ca63fdc32048 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.34.3", + "version": "0.35.0", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 3f95ecb2c7cd243983f4ec9cbc90e61883e5ad21 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 19 Nov 2015 23:01:42 -0800 Subject: [PATCH 152/328] Update to Electron v0.35.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index ca63fdc32048..793ee2215f6b 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.35.0", + "version": "0.35.1", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From b91a830cad2f69f7a777232e1d190af6a9ceaa5c Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Tue, 24 Nov 2015 06:24:13 -0800 Subject: [PATCH 153/328] Update to Electron v0.34.4 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 793ee2215f6b..5e0dc1a4734d 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.35.1", + "version": "0.34.4", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 466e4c20b417767d7d88a457a6aef0260749dad1 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 26 Nov 2015 00:07:47 -0800 Subject: [PATCH 154/328] Update to Electron v0.34.5 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 5e0dc1a4734d..4d781831ab4f 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.34.4", + "version": "0.34.5", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 1ce13f276429aff150b9d8fc7e789701fa828a01 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 27 Nov 2015 07:02:58 -0800 Subject: [PATCH 155/328] Update to Electron v0.35.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 4d781831ab4f..58b75f8709cb 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.34.5", + "version": "0.35.2", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From b1416644d5230641adf2c06c36989b81ec30cbd4 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Mon, 30 Nov 2015 12:00:54 -0800 Subject: [PATCH 156/328] add standard --- npm/cli.js | 4 ++-- npm/package.json | 5 +++-- npm/test/index.js | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/npm/cli.js b/npm/cli.js index 70ce710e0aee..bfe2c11be311 100755 --- a/npm/cli.js +++ b/npm/cli.js @@ -4,7 +4,7 @@ var electron = require('./') var proc = require('child_process') -var child = proc.spawn(electron, process.argv.slice(2), {stdio: 'inherit'}); +var child = proc.spawn(electron, process.argv.slice(2), {stdio: 'inherit'}) child.on('close', function (code) { - process.exit(code); + process.exit(code) }) diff --git a/npm/package.json b/npm/package.json index 58b75f8709cb..5adc041761b9 100644 --- a/npm/package.json +++ b/npm/package.json @@ -10,7 +10,7 @@ "cache-clean": "rm -rf ~/.electron && rm -rf dist", "postinstall": "node install.js", "pretest": "npm run cache-clean && node install.js", - "test": "tape test/*.js" + "test": "standard && tape test/*.js" }, "bin": { "electron": "cli.js" @@ -23,6 +23,7 @@ "devDependencies": { "home-path": "^0.1.1", "path-exists": "^1.0.0", + "standard": "^5.4.1", "tape": "^3.0.1" }, "author": "Mathias Buus", @@ -31,4 +32,4 @@ "url": "https://github.com/mafintosh/electron-prebuilt/issues" }, "homepage": "https://github.com/mafintosh/electron-prebuilt" -} \ No newline at end of file +} diff --git a/npm/test/index.js b/npm/test/index.js index 798a9377dc33..b0839df7cdf5 100644 --- a/npm/test/index.js +++ b/npm/test/index.js @@ -1,15 +1,15 @@ var tape = require('tape') var electron = require('../') -var path = require('path'); +var path = require('path') var pathExists = require('path-exists') var getHomePath = require('home-path')() -tape('has local binary', function(t) { +tape('has local binary', function (t) { t.ok(pathExists.sync(electron), 'electron was downloaded') t.end() }) -tape('has cache folder', function(t) { +tape('has cache folder', function (t) { t.ok(pathExists.sync(path.join(getHomePath, './.electron')), 'cache exists') t.end() }) From 85c8b66944c7ab43374095d838805b9b94367ada Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 4 Dec 2015 01:50:12 -0800 Subject: [PATCH 157/328] Update to Electron v0.35.3 --- npm/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/package.json b/npm/package.json index 5adc041761b9..94763c9b7c8b 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.35.2", + "version": "0.35.3", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", @@ -32,4 +32,4 @@ "url": "https://github.com/mafintosh/electron-prebuilt/issues" }, "homepage": "https://github.com/mafintosh/electron-prebuilt" -} +} \ No newline at end of file From 90f113cd9072f80520ff3b37da8441e59df1f862 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 4 Dec 2015 04:39:13 -0800 Subject: [PATCH 158/328] Update to Electron v0.35.4 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 94763c9b7c8b..9c3e7233a755 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.35.3", + "version": "0.35.4", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 3ce46663b92e268d775c543b6b5f3bf7c1937c2f Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Wed, 9 Dec 2015 16:16:56 +0100 Subject: [PATCH 159/328] allow rebuilds. fixes #78 --- npm/install.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/npm/install.js b/npm/install.js index 034153b60566..917d6680edd6 100755 --- a/npm/install.js +++ b/npm/install.js @@ -9,6 +9,13 @@ var path = require('path') var extract = require('extract-zip') var download = require('electron-download') +var installedVersion = null +try { + installedVersion = fs.readFileSync(path.join(__dirname, 'dist', 'version'), 'utf-8').replace(/^v/, '') +} catch (err) { + // do nothing +} + var platform = os.platform() function onerror (err) { @@ -23,6 +30,10 @@ var paths = { if (!paths[platform]) throw new Error('Unknown platform: ' + platform) +if (installedVersion === version && fs.existsSync(paths[platform])) { + return +} + // downloads if not cached download({version: version, arch: process.env.npm_config_arch}, extractFile) From b152f6d215edb616b989a01bde966fa0538e1db3 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Wed, 9 Dec 2015 16:30:46 +0100 Subject: [PATCH 160/328] be standard --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 917d6680edd6..3d12327886e1 100755 --- a/npm/install.js +++ b/npm/install.js @@ -31,7 +31,7 @@ var paths = { if (!paths[platform]) throw new Error('Unknown platform: ' + platform) if (installedVersion === version && fs.existsSync(paths[platform])) { - return + process.exit(0) } // downloads if not cached From 999a9984691dd087904f05cc4139f90e34dc68d1 Mon Sep 17 00:00:00 2001 From: Yoyo Zhou Date: Thu, 10 Dec 2015 14:43:35 -0800 Subject: [PATCH 161/328] Don't save __dirname into path.txt. Allows install to work even if our directory is moved later. --- npm/index.js | 2 +- npm/install.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/npm/index.js b/npm/index.js index 3dd25cc63114..74b576ef9fe3 100644 --- a/npm/index.js +++ b/npm/index.js @@ -1,4 +1,4 @@ var fs = require('fs') var path = require('path') -module.exports = fs.readFileSync(path.join(__dirname, 'path.txt'), 'utf-8') +module.exports = path.join(__dirname, fs.readFileSync(path.join(__dirname, 'path.txt'), 'utf-8')) diff --git a/npm/install.js b/npm/install.js index 3d12327886e1..9551a9fa036b 100755 --- a/npm/install.js +++ b/npm/install.js @@ -23,14 +23,14 @@ function onerror (err) { } var paths = { - darwin: path.join(__dirname, './dist/Electron.app/Contents/MacOS/Electron'), - linux: path.join(__dirname, './dist/electron'), - win32: path.join(__dirname, './dist/electron.exe') + darwin: 'dist/Electron.app/Contents/MacOS/Electron', + linux: 'dist/electron', + win32: 'dist/electron.exe' } if (!paths[platform]) throw new Error('Unknown platform: ' + platform) -if (installedVersion === version && fs.existsSync(paths[platform])) { +if (installedVersion === version && fs.existsSync(path.join(__dirname, paths[platform]))) { process.exit(0) } From c5394ecdc45001a89926d67f8245f8184a0df3b4 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 10 Dec 2015 23:49:49 -0800 Subject: [PATCH 162/328] Update to Electron v0.36.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 9c3e7233a755..25e80c12935e 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.35.4", + "version": "0.36.0", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 23c928afc91703b569b775ef1c43bf2e3a29952f Mon Sep 17 00:00:00 2001 From: Teran McKinney Date: Sat, 12 Dec 2015 22:14:09 +0000 Subject: [PATCH 163/328] Add FreeBSD path to install.js --- npm/install.js | 1 + 1 file changed, 1 insertion(+) diff --git a/npm/install.js b/npm/install.js index 9551a9fa036b..4a269410eba9 100755 --- a/npm/install.js +++ b/npm/install.js @@ -24,6 +24,7 @@ function onerror (err) { var paths = { darwin: 'dist/Electron.app/Contents/MacOS/Electron', + freebsd: 'dist/electron', linux: 'dist/electron', win32: 'dist/electron.exe' } From 67a80969f7c5eb66ead2d75e20bd70ed968a49cd Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 17 Dec 2015 23:17:32 -0800 Subject: [PATCH 164/328] Update to Electron v0.36.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 25e80c12935e..f198a33f3019 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.36.0", + "version": "0.36.1", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 7922082090f79c50ae4277be0f13004dc0bd64e1 Mon Sep 17 00:00:00 2001 From: Jonathan Creekmore Date: Mon, 21 Dec 2015 11:28:03 -0600 Subject: [PATCH 165/328] Allow specifying StrictSSL in the NPM config file The standard way of specifying whether you want strict-ssl or not is to add an entry into your npm config file for strict-ssl. Use that entry (which is passed to the install.js as an environment variable) to set the option for strictSSL in electron-download. --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 4a269410eba9..0e5b29614d62 100755 --- a/npm/install.js +++ b/npm/install.js @@ -36,7 +36,7 @@ if (installedVersion === version && fs.existsSync(path.join(__dirname, paths[pla } // downloads if not cached -download({version: version, arch: process.env.npm_config_arch}, extractFile) +download({version: version, arch: process.env.npm_config_arch, strictSSL: process.env.npm_config_strict_ssl}, extractFile) // unzips and makes path.txt point at the correct executable function extractFile (err, zipPath) { From c6e68a0dc39c1e78f664577aad930a5cd3e70348 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 24 Dec 2015 23:19:37 -0800 Subject: [PATCH 166/328] Update to Electron v0.36.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index f198a33f3019..81be5caddb48 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.36.1", + "version": "0.36.2", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From cdafc6a3c6e7549280c206b8af3e544698dbeb1c Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Wed, 30 Dec 2015 21:02:21 -0800 Subject: [PATCH 167/328] Update to Electron v0.35.5 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 81be5caddb48..a972d15bfcc5 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.36.2", + "version": "0.35.5", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 1876ae1912557099c33146a8ce6001f5c5e1e5fd Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 7 Jan 2016 23:39:28 -0800 Subject: [PATCH 168/328] Update to Electron v0.36.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index a972d15bfcc5..8ce0b9434d4a 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.35.5", + "version": "0.36.3", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 612848ae4d57f1a6d02a1550d8542f21d5155a15 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Sun, 10 Jan 2016 18:23:14 -0800 Subject: [PATCH 169/328] Update to Electron v0.36.3 From c8962dc43a19a07c50c5343fdf6224bfc728daa0 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Sun, 10 Jan 2016 22:30:28 -0800 Subject: [PATCH 170/328] Update to Electron v0.35.6 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 8ce0b9434d4a..41fb5fd13f2c 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.36.3", + "version": "0.35.6", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 9f87866b41d617c61ad68cf50bf433ce61494569 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Sun, 10 Jan 2016 22:38:06 -0800 Subject: [PATCH 171/328] Update to Electron v0.35.6 From db2645c12ea17950590d03a6f9e01a7e13154a5c Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 15 Jan 2016 00:09:52 -0800 Subject: [PATCH 172/328] Update to Electron v0.36.4 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 41fb5fd13f2c..f9cc398a971b 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.35.6", + "version": "0.36.4", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From c70e83da58f048c881ca1207fd845eaf12c9f794 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 22 Jan 2016 07:47:38 -0800 Subject: [PATCH 173/328] Update to Electron v0.36.5 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index f9cc398a971b..9981b08d5cb7 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.36.4", + "version": "0.36.5", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 7b4c7a1624fd0ba154c50b24dc8bf5db5dd9a845 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 29 Jan 2016 01:32:36 -0500 Subject: [PATCH 174/328] Update to Electron v0.36.6 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 9981b08d5cb7..f83044ee59a0 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.36.5", + "version": "0.36.6", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 1989552be4ba271548af88073329b97c7a66eb85 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Sat, 30 Jan 2016 02:08:35 -0500 Subject: [PATCH 175/328] Update to Electron v0.36.7 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index f83044ee59a0..acf2c369a196 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.36.6", + "version": "0.36.7", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 703ec1658ce9940d6f92ca6dbd31c557e07f0ca3 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 19 Feb 2016 02:11:19 -0800 Subject: [PATCH 176/328] Update to Electron v0.36.8 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index acf2c369a196..89e845fc3350 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.36.7", + "version": "0.36.8", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From fc78d2d8f52e1e1f42316c41504e9764b313588f Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Mon, 22 Feb 2016 23:56:27 -0300 Subject: [PATCH 177/328] Allow download builds for MAS --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 0e5b29614d62..d0a590727dad 100755 --- a/npm/install.js +++ b/npm/install.js @@ -36,7 +36,7 @@ if (installedVersion === version && fs.existsSync(path.join(__dirname, paths[pla } // downloads if not cached -download({version: version, arch: process.env.npm_config_arch, strictSSL: process.env.npm_config_strict_ssl}, extractFile) +download({version: version, platform: process.env.npm_config_platform, arch: process.env.npm_config_arch, strictSSL: process.env.npm_config_strict_ssl}, extractFile) // unzips and makes path.txt point at the correct executable function extractFile (err, zipPath) { From 2791c70c7d81fa8dd5c9d484bfa8f75ebf268a4f Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 25 Feb 2016 23:33:04 -0800 Subject: [PATCH 178/328] Update to Electron v0.36.9 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 89e845fc3350..128467b83563 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.36.8", + "version": "0.36.9", "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", From 86f9316ee07eb0c5795c97648a29d5f9146aac56 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sat, 27 Feb 2016 12:29:07 -0800 Subject: [PATCH 179/328] update github urls --- npm/README.md | 2 +- npm/package.json | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/npm/README.md b/npm/README.md index c40ed94a1859..877318eb6e9b 100644 --- a/npm/README.md +++ b/npm/README.md @@ -1,6 +1,6 @@ # electron-prebuilt -[![build status](http://img.shields.io/travis/mafintosh/electron-prebuilt.svg?style=flat)](http://travis-ci.org/mafintosh/electron-prebuilt) +[![build status](http://img.shields.io/travis/electron-userland/electron-prebuilt.svg?style=flat)](http://travis-ci.org/electron-userland/electron-prebuilt) [![dat](http://img.shields.io/badge/Development%20sponsored%20by-dat-green.svg?style=flat)](http://dat-data.com/) ![badge](https://nodei.co/npm/electron-prebuilt.png?downloads=true) diff --git a/npm/package.json b/npm/package.json index 128467b83563..166c9198d96a 100644 --- a/npm/package.json +++ b/npm/package.json @@ -4,7 +4,7 @@ "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", "repository": { "type": "git", - "url": "https://github.com/mafintosh/electron-prebuilt" + "url": "git+https://github.com/mafintosh/electron-prebuilt.git" }, "scripts": { "cache-clean": "rm -rf ~/.electron && rm -rf dist", @@ -31,5 +31,9 @@ "bugs": { "url": "https://github.com/mafintosh/electron-prebuilt/issues" }, - "homepage": "https://github.com/mafintosh/electron-prebuilt" -} \ No newline at end of file + "homepage": "https://github.com/mafintosh/electron-prebuilt", + "directories": { + "test": "test" + }, + "keywords": [] +} From 79f552e69e4d798ed374d4e3f07b4cc11645f192 Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sat, 27 Feb 2016 12:52:39 -0800 Subject: [PATCH 180/328] rename mafintosh -> electron-userland --- npm/README.md | 3 +-- npm/package.json | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/npm/README.md b/npm/README.md index 877318eb6e9b..1ab35eda2dd7 100644 --- a/npm/README.md +++ b/npm/README.md @@ -1,7 +1,6 @@ # electron-prebuilt [![build status](http://img.shields.io/travis/electron-userland/electron-prebuilt.svg?style=flat)](http://travis-ci.org/electron-userland/electron-prebuilt) -[![dat](http://img.shields.io/badge/Development%20sponsored%20by-dat-green.svg?style=flat)](http://dat-data.com/) ![badge](https://nodei.co/npm/electron-prebuilt.png?downloads=true) @@ -64,7 +63,7 @@ electron your-app/ ## Related modules -- [electron-packager](https://github.com/maxogden/electron-packager) - package and distribute your electron app in OS executables (.app, .exe etc) +- [electron-packager](https://github.com/electron-userland/electron-packager) - package and distribute your electron app in OS executables (.app, .exe etc) - [electron-builder](https://github.com/loopline-systems/electron-builder) - create installers for Windows and OS X. It's built to work together with electron-packager - [menubar](https://github.com/maxogden/menubar) - high level way to create menubar desktop applications with electron diff --git a/npm/package.json b/npm/package.json index 166c9198d96a..79bd6fce260f 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,10 +1,10 @@ { "name": "electron-prebuilt", "version": "0.36.9", - "description": "Install electron (formerly called atom-shell) prebuilt binaries for command-line use using npm", + "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", - "url": "git+https://github.com/mafintosh/electron-prebuilt.git" + "url": "git+https://github.com/electron-userland/electron-prebuilt.git" }, "scripts": { "cache-clean": "rm -rf ~/.electron && rm -rf dist", @@ -29,9 +29,9 @@ "author": "Mathias Buus", "license": "MIT", "bugs": { - "url": "https://github.com/mafintosh/electron-prebuilt/issues" + "url": "https://github.com/electron-userland/electron-prebuilt/issues" }, - "homepage": "https://github.com/mafintosh/electron-prebuilt", + "homepage": "https://github.com/electron-userland/electron-prebuilt", "directories": { "test": "test" }, From 9295aa6103635f45ecda4d6be9362ee12453c05a Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Wed, 2 Mar 2016 16:45:48 -0500 Subject: [PATCH 181/328] Fix strict-ssl detection. When `strict-ssl` is set to a truthy value, npm always turns the environment variable into the string `true`, when the value is falsy, npm always sets it to a blank string. This fixes strict-ssl detection by always comparing the value of npm_config_strict_ssl to the string `"true"` --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index d0a590727dad..cf9d57037a00 100755 --- a/npm/install.js +++ b/npm/install.js @@ -36,7 +36,7 @@ if (installedVersion === version && fs.existsSync(path.join(__dirname, paths[pla } // downloads if not cached -download({version: version, platform: process.env.npm_config_platform, arch: process.env.npm_config_arch, strictSSL: process.env.npm_config_strict_ssl}, extractFile) +download({version: version, platform: process.env.npm_config_platform, arch: process.env.npm_config_arch, strictSSL: process.env.npm_config_strict_ssl === 'true'}, extractFile) // unzips and makes path.txt point at the correct executable function extractFile (err, zipPath) { From 079d8aa7b4334bafcbeb5fee3bcec20405ad249c Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Thu, 3 Mar 2016 18:09:02 -0800 Subject: [PATCH 182/328] upgrade to electron-download 2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 79bd6fce260f..6ae5a44453c2 100644 --- a/npm/package.json +++ b/npm/package.json @@ -18,7 +18,7 @@ "main": "index.js", "dependencies": { "extract-zip": "^1.0.3", - "electron-download": "^1.0.0" + "electron-download": "^2.0.0" }, "devDependencies": { "home-path": "^0.1.1", From 03f53099b5feb08b58fd2eed30109c750fd584cd Mon Sep 17 00:00:00 2001 From: Max Ogden Date: Sat, 5 Mar 2016 10:19:20 -0800 Subject: [PATCH 183/328] 0.36.10 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 6ae5a44453c2..b0aff1de0498 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.36.9", + "version": "0.36.10", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From dccd2cfbc5ccf270f70f0700aac9d888b79500e9 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 11 Mar 2016 04:39:31 -0800 Subject: [PATCH 184/328] Update to Electron v0.36.11 --- npm/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/package.json b/npm/package.json index b0aff1de0498..d015134411a8 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.36.10", + "version": "0.36.11", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", @@ -36,4 +36,4 @@ "test": "test" }, "keywords": [] -} +} \ No newline at end of file From 6b35f5200b2ff0402148b01b543465670a617379 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 11 Mar 2016 21:35:41 -0800 Subject: [PATCH 185/328] Update to Electron v0.37.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index d015134411a8..3c759c4b6d33 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.36.11", + "version": "0.37.0", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From b82ef0b3da98dfd7c8adb4a0d7a88272b4392bb3 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Sat, 12 Mar 2016 19:00:05 -0800 Subject: [PATCH 186/328] Update to Electron v0.37.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 3c759c4b6d33..24fc880d8372 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.37.0", + "version": "0.37.1", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 8327ee3f1d54d6356601b27a67ec42c6ea9d16c6 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Sat, 12 Mar 2016 20:14:41 -0800 Subject: [PATCH 187/328] Update to Electron v0.37.1 From 7683eec6d3e45bd6a94b9ffac1bf738d35f7749f Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Mon, 14 Mar 2016 04:21:56 -0700 Subject: [PATCH 188/328] Update to Electron v0.37.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 24fc880d8372..43c5e864773a 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.37.1", + "version": "0.37.2", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 4ee1c49bf0b94db66339d31879c59f6c796f8223 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Sat, 26 Mar 2016 20:15:39 -0700 Subject: [PATCH 189/328] Update to Electron v0.36.12 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 43c5e864773a..4ae3781517bd 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.37.2", + "version": "0.36.12", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 0d16de7ef73b767cc1926141b80b36cc22a005a3 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Sat, 26 Mar 2016 21:51:19 -0700 Subject: [PATCH 190/328] Update to Electron v0.37.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 4ae3781517bd..e5c346492724 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.36.12", + "version": "0.37.3", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 36969c8a1d5ecef6fad88ad320f724fa0bf072d2 Mon Sep 17 00:00:00 2001 From: Mitchell Hentges Date: Tue, 29 Mar 2016 09:41:39 +0200 Subject: [PATCH 191/328] Make npm badge link to package page --- npm/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/README.md b/npm/README.md index 1ab35eda2dd7..009d3e906ed8 100644 --- a/npm/README.md +++ b/npm/README.md @@ -2,7 +2,7 @@ [![build status](http://img.shields.io/travis/electron-userland/electron-prebuilt.svg?style=flat)](http://travis-ci.org/electron-userland/electron-prebuilt) -![badge](https://nodei.co/npm/electron-prebuilt.png?downloads=true) +[![badge](https://nodei.co/npm/electron-prebuilt.png?downloads=true)](https://www.npmjs.com/package/electron-prebuilt) Install [electron](https://github.com/atom/electron) prebuilt binaries for command-line use using npm. This module helps you easily install the `electron` command for use on the command line without having to compile anything. From 5565c5825a26cded029a23be3258e25f5de9e87b Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 1 Apr 2016 12:51:12 -0700 Subject: [PATCH 192/328] Create issue_template.md --- npm/issue_template.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 npm/issue_template.md diff --git a/npm/issue_template.md b/npm/issue_template.md new file mode 100644 index 000000000000..142ef2e044b4 --- /dev/null +++ b/npm/issue_template.md @@ -0,0 +1,6 @@ +If there is an existing Electron issue for this, please link it here: + +https://github.com/atom/electron/issues + +Describe your problem: + From 63b10afd283ddb8de16af37d258d224c548e72f3 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Sun, 3 Apr 2016 04:04:39 -0700 Subject: [PATCH 193/328] Update to Electron v0.37.4 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index e5c346492724..8f44f67c25fe 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.37.3", + "version": "0.37.4", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 05bf926f6b5f3d3deb6c34a20e2f8e5f620cf4ec Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Wed, 6 Apr 2016 21:44:14 -0700 Subject: [PATCH 194/328] Update to Electron v0.37.5 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 8f44f67c25fe..e288f4621a9f 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.37.4", + "version": "0.37.5", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 3a001a30f1833a0c956eba2272a83c2c546af6b4 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 15 Apr 2016 03:31:16 -0700 Subject: [PATCH 195/328] Update to Electron v0.37.6 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index e288f4621a9f..a22945393ba3 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.37.5", + "version": "0.37.6", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 21c66e1aee2ff2cb7cd9d5faef60ac23838542cc Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 22 Apr 2016 04:10:55 -0700 Subject: [PATCH 196/328] Update to Electron v0.37.7 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index a22945393ba3..3fbe9de7fe72 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.37.6", + "version": "0.37.7", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 562e7518422a296f271db914d50f6523a0fbd079 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 29 Apr 2016 06:30:31 -0700 Subject: [PATCH 197/328] Update to Electron v0.37.8 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 3fbe9de7fe72..9e089826b60b 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.37.7", + "version": "0.37.8", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 2e177ff56717e51d02816af81a2ab1a394ca9b82 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Wed, 11 May 2016 08:04:42 +0200 Subject: [PATCH 198/328] Update to Electron v1.0.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 9e089826b60b..730ec06c4971 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "0.37.8", + "version": "1.0.0", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 481659a195200ef8f4b78534c8d7a7a3329d4566 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Wed, 11 May 2016 13:08:01 +0200 Subject: [PATCH 199/328] Update to Electron v1.0.0 From f09443c70a7e0ce2829734e0238ddda76bd97963 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Wed, 11 May 2016 14:54:14 +0200 Subject: [PATCH 200/328] Update to Electron v1.0.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 730ec06c4971..a84a57295451 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.0.0", + "version": "1.0.1", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 70e2fa0312b975c673b16bc7392fda02ad88e533 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 13 May 2016 04:32:12 +0200 Subject: [PATCH 201/328] Update to Electron v1.0.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index a84a57295451..12a26799a018 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.0.1", + "version": "1.0.2", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 7344bb81a4eb5417bd2b4f7205f2eec02c7cf122 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Sat, 14 May 2016 01:46:45 +0000 Subject: [PATCH 202/328] Update to Electron v1.1.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 12a26799a018..3a3822516222 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.0.2", + "version": "1.1.0", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From c28a0c313b1a231ebf8a5d1a66bcc946e2848bb4 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Fri, 20 May 2016 01:42:29 +0000 Subject: [PATCH 203/328] Update to Electron v1.1.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 3a3822516222..ed8c921be697 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.1.0", + "version": "1.1.1", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 4db88fa7e8d8140c04c83a8c78645e53b9a08e34 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Tue, 24 May 2016 10:26:17 +0000 Subject: [PATCH 204/328] Update to Electron v1.1.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index ed8c921be697..62448db09ef1 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.1.1", + "version": "1.1.2", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 9f0229d768eb3524b4edf543456e4ebd6c2dd13b Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Wed, 25 May 2016 07:03:55 +0000 Subject: [PATCH 205/328] Update to Electron v1.1.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 62448db09ef1..f66cf5528b66 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.1.2", + "version": "1.1.3", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From cac2f560c3391790aef71177dabeaea1ddd765d4 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 26 May 2016 13:00:40 +0200 Subject: [PATCH 206/328] Update to Electron v1.2.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index f66cf5528b66..67f01580c8f9 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.1.3", + "version": "1.2.0", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 1d7991f2db4f9e227ee3faad0ffe0d737569d775 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Wed, 1 Jun 2016 11:03:09 +0200 Subject: [PATCH 207/328] Update to Electron v1.2.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 67f01580c8f9..2fa53e3674dc 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.2.0", + "version": "1.2.1", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From c4e7d972057fd5a1889ceb756028481ff07a86e8 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Wed, 8 Jun 2016 03:22:05 -0700 Subject: [PATCH 208/328] Update to Electron v1.2.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 2fa53e3674dc..83380c052672 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.2.1", + "version": "1.2.2", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 9881f3a2c43782a1f1a774c8face23c6704085e3 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Wed, 15 Jun 2016 23:02:50 -0700 Subject: [PATCH 209/328] Update to Electron v1.2.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 83380c052672..b250029819c6 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.2.2", + "version": "1.2.3", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 9e123b484acfaac3ce0beb6cee4db8770110e6be Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Tue, 21 Jun 2016 21:21:35 -0700 Subject: [PATCH 210/328] Update to Electron v1.2.4 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index b250029819c6..c4bce6020a11 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.2.3", + "version": "1.2.4", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From e35a83b62ade97e1c5ec18bf31d9b8c255c451e2 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 23 Jun 2016 01:03:52 -0700 Subject: [PATCH 211/328] Update to Electron v1.2.5 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index c4bce6020a11..458a8b5644f2 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.2.4", + "version": "1.2.5", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From ac3ced02877ad832ceb5d90dc7950f19afb9377b Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Tue, 5 Jul 2016 23:20:58 -0700 Subject: [PATCH 212/328] Update to Electron v1.2.6 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 458a8b5644f2..57107ff773db 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.2.5", + "version": "1.2.6", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 07fefbcf40df7394c5f6a5d02d750cf14dfead48 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Tue, 5 Jul 2016 23:43:56 -0700 Subject: [PATCH 213/328] Update to Electron v1.2.6 From 5c36709ff252c41515d5d94e15c7985e5de8e366 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Tue, 12 Jul 2016 22:19:41 -0700 Subject: [PATCH 214/328] Update to Electron v1.2.7 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 57107ff773db..40f43a740b15 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.2.6", + "version": "1.2.7", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 4f20a1590728a0123947c731005c3d1c61c3d383 Mon Sep 17 00:00:00 2001 From: Emily Date: Fri, 15 Jul 2016 11:17:54 +0900 Subject: [PATCH 215/328] change platform path to match downloaded one --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index cf9d57037a00..02868ce9a9db 100755 --- a/npm/install.js +++ b/npm/install.js @@ -16,7 +16,7 @@ try { // do nothing } -var platform = os.platform() +var platform = process.env.npm_config_platform function onerror (err) { throw err From dfde9ea81445a4098d007b8c3cc22b854046c7fd Mon Sep 17 00:00:00 2001 From: Emily Date: Fri, 15 Jul 2016 13:09:12 +0900 Subject: [PATCH 216/328] added or to handle undefined --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 02868ce9a9db..35fc41484079 100755 --- a/npm/install.js +++ b/npm/install.js @@ -16,7 +16,7 @@ try { // do nothing } -var platform = process.env.npm_config_platform +var platform = process.env.npm_config_platform || os.platform() function onerror (err) { throw err From 1e3d131f46f470bde8102bbb4c22411e34f56def Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Thu, 21 Jul 2016 00:16:30 -0700 Subject: [PATCH 217/328] Update to Electron v1.2.8 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 40f43a740b15..cf8cc7d38bff 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.2.7", + "version": "1.2.8", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From 31684657595098031c2ade6762b4ae5464e03c0f Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Sun, 24 Jul 2016 22:08:44 -0700 Subject: [PATCH 218/328] Update to Electron v1.3.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index cf8cc7d38bff..e902f24b1b9a 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.2.8", + "version": "1.3.0", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From b562ad9484b98fd13f78ab032c4f060c5d4b4323 Mon Sep 17 00:00:00 2001 From: "=^._.^=" Date: Tue, 26 Jul 2016 22:47:36 -0700 Subject: [PATCH 219/328] Update to Electron v1.3.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index e902f24b1b9a..3ec9b2d47d5e 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron-prebuilt", - "version": "1.3.0", + "version": "1.3.1", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { "type": "git", From a14acd21349ac5a06bd1b7a5ea80c39a87ddea29 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Mon, 25 Jul 2016 12:15:21 -0700 Subject: [PATCH 220/328] change npm package name to electron --- npm/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/package.json b/npm/package.json index 3ec9b2d47d5e..67c1677ca592 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,5 +1,5 @@ { - "name": "electron-prebuilt", + "name": "electron", "version": "1.3.1", "description": "Install electron prebuilt binaries for the command-line use using npm", "repository": { @@ -36,4 +36,4 @@ "test": "test" }, "keywords": [] -} \ No newline at end of file +} From 216714f27a95502a37de8623773e8e312478c0f2 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Mon, 25 Jul 2016 12:48:20 -0700 Subject: [PATCH 221/328] clean up package.json --- npm/package.json | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/npm/package.json b/npm/package.json index 67c1677ca592..41bed95e88a1 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,11 +1,8 @@ { "name": "electron", "version": "1.3.1", - "description": "Install electron prebuilt binaries for the command-line use using npm", - "repository": { - "type": "git", - "url": "git+https://github.com/electron-userland/electron-prebuilt.git" - }, + "description": "Install prebuilt electron binaries for the command-line using npm", + "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { "cache-clean": "rm -rf ~/.electron && rm -rf dist", "postinstall": "node install.js", @@ -28,12 +25,8 @@ }, "author": "Mathias Buus", "license": "MIT", - "bugs": { - "url": "https://github.com/electron-userland/electron-prebuilt/issues" - }, - "homepage": "https://github.com/electron-userland/electron-prebuilt", "directories": { "test": "test" }, - "keywords": [] + "keywords": ["electron"] } From 0946859d1ecac33994de09bb65ccd6f926698676 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Thu, 28 Jul 2016 10:24:38 -0700 Subject: [PATCH 222/328] update docs to use new `electron` package name --- npm/README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/npm/README.md b/npm/README.md index 009d3e906ed8..8da9ea4b8767 100644 --- a/npm/README.md +++ b/npm/README.md @@ -13,7 +13,7 @@ Electron is a JavaScript runtime that bundles Node.js and Chromium. You use it s Download and install the latest build of electron for your OS and add it to your projects `package.json` as a `devDependency`: ``` -npm install electron-prebuilt --save-dev +npm install electron --save-dev ``` This is the preferred way to use electron, as it doesn't require users to install electron globally. @@ -21,13 +21,13 @@ This is the preferred way to use electron, as it doesn't require users to instal You can also use the `-g` flag (global) to symlink it into your PATH: ``` -npm install -g electron-prebuilt +npm install -g electron ``` If that command fails with an `EACCESS` error you may have to run it again with `sudo`: ``` -sudo npm install -g electron-prebuilt +sudo npm install -g electron ``` Now you can just run `electron` to run electron: @@ -40,7 +40,7 @@ If you need to use an HTTP proxy you can [set these environment variables](https If you want to change the architecture that is downloaded (e.g., `ia32` on an `x64` machine), you can use the `--arch` flag with npm install or set the `npm_config_arch` environment variable: ``` -npm install --arch=ia32 electron-prebuilt +npm install --arch=ia32 electron ``` ## About @@ -71,11 +71,12 @@ Find more at the [awesome-electron](https://github.com/sindresorhus/awesome-elec ## Programmatic usage -Most people use this from the command line, but if you require `electron-prebuilt` inside your node app it will return the file path to the binary. -Use this to spawn electron from node scripts. +Most people use this from the command line, but if you require `electron` inside +your **node app** (not your electron app) it will return the file path to the +binary. Use this to spawn electron from node scripts: ``` js -var electron = require('electron-prebuilt') +var electron = require('electron') var proc = require('child_process') // will something similar to print /Users/maf/.../Electron From 11fc32b59b76aa6847870728f854eb444618bc6d Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Thu, 28 Jul 2016 10:25:18 -0700 Subject: [PATCH 223/328] electron moved to the `electron` org --- npm/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/npm/README.md b/npm/README.md index 8da9ea4b8767..428f75b7ac13 100644 --- a/npm/README.md +++ b/npm/README.md @@ -4,9 +4,9 @@ [![badge](https://nodei.co/npm/electron-prebuilt.png?downloads=true)](https://www.npmjs.com/package/electron-prebuilt) -Install [electron](https://github.com/atom/electron) prebuilt binaries for command-line use using npm. This module helps you easily install the `electron` command for use on the command line without having to compile anything. +Install [electron](https://github.com/electron/electron) prebuilt binaries for command-line use using npm. This module helps you easily install the `electron` command for use on the command line without having to compile anything. -Electron is a JavaScript runtime that bundles Node.js and Chromium. You use it similar to the `node` command on the command line for executing JavaScript programs. For more info you can read [this intro blog post](http://maxogden.com/electron-fundamentals.html) or dive into the [Electron documentation](https://github.com/atom/electron/tree/master/docs) +Electron is a JavaScript runtime that bundles Node.js and Chromium. You use it similar to the `node` command on the command line for executing JavaScript programs. For more info you can read [this intro blog post](http://maxogden.com/electron-fundamentals.html) or dive into the [Electron documentation](https://github.com/electron/electron/tree/master/docs) ## Installation @@ -45,15 +45,15 @@ npm install --arch=ia32 electron ## About -Works on Mac, Windows and Linux OSes that Electron supports (e.g. Electron [does not support Windows XP](https://github.com/atom/electron/issues/691)). +Works on Mac, Windows and Linux OSes that Electron supports (e.g. Electron [does not support Windows XP](https://github.com/electron/electron/issues/691)). -The version numbers of this module match the version number of the [offical Electron releases](https://github.com/atom/electron/releases), which do not follow [semantic versioning](http://semver.org/). +The version numbers of this module match the version number of the [offical Electron releases](https://github.com/electron/electron/releases), which do not follow [semantic versioning](http://semver.org/). This module is automatically released whenever a new version of Electron is released thanks to [electron-prebuilt-updater](https://github.com/johnmuhl/electron-prebuilt-updater) written by [John Muhl](https://github.com/johnmuhl/). ## Usage -First you have to [write an electron application](https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md) +First you have to [write an electron application](https://github.com/electron/electron/blob/master/docs/tutorial/quick-start.md) Then you can run your app using: From 0733ec9758b922432e0309c8675b4b40e8bcebbc Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Thu, 28 Jul 2016 10:51:46 -0700 Subject: [PATCH 224/328] update links in readme intro --- npm/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/npm/README.md b/npm/README.md index 428f75b7ac13..7905af38fdb4 100644 --- a/npm/README.md +++ b/npm/README.md @@ -6,7 +6,9 @@ Install [electron](https://github.com/electron/electron) prebuilt binaries for command-line use using npm. This module helps you easily install the `electron` command for use on the command line without having to compile anything. -Electron is a JavaScript runtime that bundles Node.js and Chromium. You use it similar to the `node` command on the command line for executing JavaScript programs. For more info you can read [this intro blog post](http://maxogden.com/electron-fundamentals.html) or dive into the [Electron documentation](https://github.com/electron/electron/tree/master/docs) +[Electron](http://electron.atom.io) is a JavaScript runtime that bundles Node.js +and Chromium. You use it similar to the `node` command on the command line for +executing JavaScript programs. For more info you can read [this intro blog post](http://maxogden.com/electron-fundamentals.html) or dive into the [Electron documentation](http://electron.atom.io/docs) ## Installation From e2f3f6828c40dab3a079cc3ead837d9671313190 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Thu, 28 Jul 2016 10:52:05 -0700 Subject: [PATCH 225/328] add a note about the name change --- npm/README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/npm/README.md b/npm/README.md index 7905af38fdb4..5bad74b7333f 100644 --- a/npm/README.md +++ b/npm/README.md @@ -12,13 +12,20 @@ executing JavaScript programs. For more info you can read [this intro blog post] ## Installation -Download and install the latest build of electron for your OS and add it to your projects `package.json` as a `devDependency`: +**Note** As of version 1.3.1, this package is published to npm under two names: +`electron` and `electron-prebuilt`. You can currently use either name, but +`electron` is recommended, as the `electron-prebuilt` name is deprecated, and +will only be published until the end of 2016. + +Download and install the latest build of electron for your OS and add it to your +project's `package.json` as a `devDependency`: ``` npm install electron --save-dev ``` -This is the preferred way to use electron, as it doesn't require users to install electron globally. +This is the preferred way to use electron, as it doesn't require users to +install electron globally. You can also use the `-g` flag (global) to symlink it into your PATH: From 7dc95671cda1b35fdf28fe3b1d051b23a0196a85 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 28 Jul 2016 13:47:03 -0700 Subject: [PATCH 226/328] Tweak unknown platform error message --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index cf9d57037a00..5ec84203b8b8 100755 --- a/npm/install.js +++ b/npm/install.js @@ -29,7 +29,7 @@ var paths = { win32: 'dist/electron.exe' } -if (!paths[platform]) throw new Error('Unknown platform: ' + platform) +if (!paths[platform]) throw new Error('Electron builds are not available on platform: ' + platform) if (installedVersion === version && fs.existsSync(path.join(__dirname, paths[platform]))) { process.exit(0) From 9627ad923bc843720202e537dce717cc39e06ca1 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Fri, 29 Jul 2016 10:25:03 -0700 Subject: [PATCH 227/328] update repo url in contributing.md --- npm/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/CONTRIBUTING.md b/npm/CONTRIBUTING.md index c24021566105..d3b733772763 100644 --- a/npm/CONTRIBUTING.md +++ b/npm/CONTRIBUTING.md @@ -1,6 +1,6 @@ releases for this module are handled by https://github.com/johnmuhl/electron-prebuilt-updater -versions published to npm should match the versions published to [github releases for electron](https://github.com/atom/electron/releases) +versions published to npm should match the versions published to [github releases for electron](https://github.com/electron/electron/releases) coding style should be `standard`: From 5c0edc55a8a4bad84ed37c8bd58083e00e1a5c3e Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Fri, 29 Jul 2016 10:25:18 -0700 Subject: [PATCH 228/328] update issue template to help avoid misfiled issues --- npm/issue_template.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/npm/issue_template.md b/npm/issue_template.md index 142ef2e044b4..d9ff970227d6 100644 --- a/npm/issue_template.md +++ b/npm/issue_template.md @@ -1,6 +1,6 @@ -If there is an existing Electron issue for this, please link it here: +If you're having an issue _installing_ Electron, this is the place to report it. -https://github.com/atom/electron/issues - -Describe your problem: +If you're having an issue _using_ Electron, please report it at https://github.com/electron/electron/issues +* Electron version: +* Operating system: From 6c7d426b2cbd0e599ea28b534acd7754250172c4 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 2 Aug 2016 16:27:38 -0700 Subject: [PATCH 229/328] Update to Electron v1.3.2 --- npm/package.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/npm/package.json b/npm/package.json index 41bed95e88a1..4a84457a2ad1 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.3.1", + "version": "1.3.2", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { @@ -28,5 +28,7 @@ "directories": { "test": "test" }, - "keywords": ["electron"] -} + "keywords": [ + "electron" + ] +} \ No newline at end of file From 60d8c732c15d9976f6f7ab61fb0361dad35e7a6f Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Sun, 7 Aug 2016 13:22:46 -0700 Subject: [PATCH 230/328] Cleanup README --- npm/README.md | 67 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/npm/README.md b/npm/README.md index 5bad74b7333f..8657b4c083b6 100644 --- a/npm/README.md +++ b/npm/README.md @@ -4,11 +4,14 @@ [![badge](https://nodei.co/npm/electron-prebuilt.png?downloads=true)](https://www.npmjs.com/package/electron-prebuilt) -Install [electron](https://github.com/electron/electron) prebuilt binaries for command-line use using npm. This module helps you easily install the `electron` command for use on the command line without having to compile anything. +Install [Electron](https://github.com/electron/electron) prebuilt binaries for +command-line use using npm. This module helps you easily install the `electron` +command for use on the command line without having to compile anything. [Electron](http://electron.atom.io) is a JavaScript runtime that bundles Node.js and Chromium. You use it similar to the `node` command on the command line for -executing JavaScript programs. For more info you can read [this intro blog post](http://maxogden.com/electron-fundamentals.html) or dive into the [Electron documentation](http://electron.atom.io/docs) +executing JavaScript programs. For more info you can read [this intro blog post](http://maxogden.com/electron-fundamentals.html) +or dive into the [Electron documentation](http://electron.atom.io/docs). ## Installation @@ -17,80 +20,92 @@ executing JavaScript programs. For more info you can read [this intro blog post] `electron` is recommended, as the `electron-prebuilt` name is deprecated, and will only be published until the end of 2016. -Download and install the latest build of electron for your OS and add it to your +Download and install the latest build of Electron for your OS and add it to your project's `package.json` as a `devDependency`: -``` +```shell npm install electron --save-dev ``` -This is the preferred way to use electron, as it doesn't require users to -install electron globally. +This is the preferred way to use Electron, as it doesn't require users to +install Electron globally. You can also use the `-g` flag (global) to symlink it into your PATH: -``` +```shell npm install -g electron ``` If that command fails with an `EACCESS` error you may have to run it again with `sudo`: -``` +```shell sudo npm install -g electron ``` Now you can just run `electron` to run electron: -``` +```shell electron ``` -If you need to use an HTTP proxy you can [set these environment variables](https://github.com/request/request/tree/f0c4ec061141051988d1216c24936ad2e7d5c45d#controlling-proxy-behaviour-using-environment-variables) +If you need to use an HTTP proxy you can [set these environment variables](https://github.com/request/request/tree/f0c4ec061141051988d1216c24936ad2e7d5c45d#controlling-proxy-behaviour-using-environment-variables). -If you want to change the architecture that is downloaded (e.g., `ia32` on an `x64` machine), you can use the `--arch` flag with npm install or set the `npm_config_arch` environment variable: -``` +If you want to change the architecture that is downloaded (e.g., `ia32` on an +`x64` machine), you can use the `--arch` flag with npm install or set the +`npm_config_arch` environment variable: + +```shell npm install --arch=ia32 electron ``` ## About -Works on Mac, Windows and Linux OSes that Electron supports (e.g. Electron [does not support Windows XP](https://github.com/electron/electron/issues/691)). +Works on Mac, Windows and Linux OSes that Electron supports (e.g. Electron +[does not support Windows XP](https://github.com/electron/electron/issues/691)). -The version numbers of this module match the version number of the [offical Electron releases](https://github.com/electron/electron/releases), which do not follow [semantic versioning](http://semver.org/). +The version numbers of this module match the version number of the [official +Electron releases](https://github.com/electron/electron/releases), which +[do not follow semantic versioning](http://electron.atom.io/docs/tutorial/electron-versioning/). -This module is automatically released whenever a new version of Electron is released thanks to [electron-prebuilt-updater](https://github.com/johnmuhl/electron-prebuilt-updater) written by [John Muhl](https://github.com/johnmuhl/). +This module is automatically released whenever a new version of Electron is +released thanks to [electron-prebuilt-updater](https://github.com/electron/electron-prebuilt-updater), +originally written by [John Muhl](https://github.com/johnmuhl/). ## Usage -First you have to [write an electron application](https://github.com/electron/electron/blob/master/docs/tutorial/quick-start.md) +First, you have to [write an Electron application](http://electron.atom.io/docs/tutorial/quick-start/). -Then you can run your app using: +Then, you can run your app using: -``` +```shell electron your-app/ ``` ## Related modules -- [electron-packager](https://github.com/electron-userland/electron-packager) - package and distribute your electron app in OS executables (.app, .exe etc) -- [electron-builder](https://github.com/loopline-systems/electron-builder) - create installers for Windows and OS X. It's built to work together with electron-packager -- [menubar](https://github.com/maxogden/menubar) - high level way to create menubar desktop applications with electron +- [electron-packager](https://github.com/electron-userland/electron-packager) - + Package and distribute your Electron app with OS-specific bundles + (.app, .exe etc) +- [electron-builder](https://github.com/electron-userland/electron-builder) - + create installers +- [menubar](https://github.com/maxogden/menubar) - high level way to create + menubar desktop applications with electron -Find more at the [awesome-electron](https://github.com/sindresorhus/awesome-electron) list +Find more at the [awesome-electron](https://github.com/sindresorhus/awesome-electron) list. ## Programmatic usage Most people use this from the command line, but if you require `electron` inside -your **node app** (not your electron app) it will return the file path to the -binary. Use this to spawn electron from node scripts: +your **Node app** (not your Electron app) it will return the file path to the +binary. Use this to spawn Electron from Node scripts: -``` js +```javascript var electron = require('electron') var proc = require('child_process') // will something similar to print /Users/maf/.../Electron console.log(electron) -// spawn electron +// spawn Electron var child = proc.spawn(electron) ``` From 2a8b97ce34348a63237f64af20a3eab650437f09 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Wed, 10 Aug 2016 04:09:36 -0700 Subject: [PATCH 231/328] Update to Electron v1.3.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 4a84457a2ad1..b8b050bb1835 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.3.2", + "version": "1.3.3", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 518e8cc2f784d3ca186465718013530f3fa5bbde Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 23 Aug 2016 03:50:37 -0700 Subject: [PATCH 232/328] Update to Electron v1.3.4 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index b8b050bb1835..03c8e45e5c71 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.3.3", + "version": "1.3.4", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 573332721a5d76c3ab112d2cf69488a514620490 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Fri, 2 Sep 2016 00:57:13 -0700 Subject: [PATCH 233/328] Update to Electron v1.3.5 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 03c8e45e5c71..940c1375f713 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.3.4", + "version": "1.3.5", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 004d25d2489916e8a39d092e6ddf0ab327a2a7fa Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Sat, 10 Sep 2016 08:59:40 -0700 Subject: [PATCH 234/328] Upgrade electron-download for checksum support Fixes #51. --- npm/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/npm/package.json b/npm/package.json index 940c1375f713..fbbf22b8b0cc 100644 --- a/npm/package.json +++ b/npm/package.json @@ -15,11 +15,11 @@ "main": "index.js", "dependencies": { "extract-zip": "^1.0.3", - "electron-download": "^2.0.0" + "electron-download": "^2.2.0" }, "devDependencies": { "home-path": "^0.1.1", - "path-exists": "^1.0.0", + "path-exists": "^2.0.0", "standard": "^5.4.1", "tape": "^3.0.1" }, @@ -31,4 +31,4 @@ "keywords": [ "electron" ] -} \ No newline at end of file +} From 94f05d350bf8f577692717f730a3e349adf99ace Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Sat, 10 Sep 2016 09:02:25 -0700 Subject: [PATCH 235/328] Travis: test against Node >= 4 on Linux & OSX --- npm/.travis.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/npm/.travis.yml b/npm/.travis.yml index 991d04b6e227..a374ed2c0a97 100644 --- a/npm/.travis.yml +++ b/npm/.travis.yml @@ -1,5 +1,8 @@ +os: +- linux +- osx language: node_js node_js: - - '0.10' - - '0.12' - - 'iojs' +- '4' +- '5' +- '6' From db0b8b53740c30d319e54d66ae3b38be5169bf70 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Wed, 14 Sep 2016 00:18:42 -0700 Subject: [PATCH 236/328] Update to Electron v1.3.6 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 940c1375f713..9abc55f35caf 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.3.5", + "version": "1.3.6", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From b8233eb8e6fe1b2ffe20b6954fed889a83bffc37 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Wed, 14 Sep 2016 18:30:41 -0700 Subject: [PATCH 237/328] Update to Electron v1.3.6 From 6b715a16cb4e79702993aac1f9fae9c624e7b8e4 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 15 Sep 2016 00:25:33 -0700 Subject: [PATCH 238/328] Update to Electron v1.4.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 9abc55f35caf..8e14ca2bd567 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.3.6", + "version": "1.4.0", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 119535525faa708daf5207c1ec64f06403639e42 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 19 Sep 2016 13:38:48 -0700 Subject: [PATCH 239/328] :arrow_up: electron-download@3.0.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index fbbf22b8b0cc..f0ef1742dd86 100644 --- a/npm/package.json +++ b/npm/package.json @@ -15,7 +15,7 @@ "main": "index.js", "dependencies": { "extract-zip": "^1.0.3", - "electron-download": "^2.2.0" + "electron-download": "^3.0.0" }, "devDependencies": { "home-path": "^0.1.1", From 5cbc2abf614571937c286612469e94ade3496e72 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 19 Sep 2016 13:40:17 -0700 Subject: [PATCH 240/328] Build on node 0.10/0.12 --- npm/.travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/npm/.travis.yml b/npm/.travis.yml index a374ed2c0a97..9dbea0f239fb 100644 --- a/npm/.travis.yml +++ b/npm/.travis.yml @@ -3,6 +3,8 @@ os: - osx language: node_js node_js: +- '0.10' +- '0.12' - '4' - '5' - '6' From 9fd625fb9b6be7f3abf0bbaced9094fd2b0cb0c4 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 19 Sep 2016 13:46:37 -0700 Subject: [PATCH 241/328] Add initial AppVeyor config --- npm/appveyor.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 npm/appveyor.yml diff --git a/npm/appveyor.yml b/npm/appveyor.yml new file mode 100644 index 000000000000..abe461df8e8a --- /dev/null +++ b/npm/appveyor.yml @@ -0,0 +1,25 @@ +build: off + +branches: + only: + - master + +environment: + matrix: + - nodejs_version: "0.10" + - nodejs_version: "0.12" + - nodejs_version: "4" + - nodejs_version: "5" + - nodejs_version: "6" + +skip_tags: true + +install: + - ps: Install-Product node $env:nodejs_version + - npm install npm + - .\node_modules\.bin\npm install + +test_script: + - node --version + - .\node_modules\.bin\npm --version + - .\node_modules\.bin\npm test From d0a509a9158b891eb25902d2950692856957cbad Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 19 Sep 2016 13:48:05 -0700 Subject: [PATCH 242/328] npm ignore more meta files and tests --- npm/.npmignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/npm/.npmignore b/npm/.npmignore index fe67adfa7c33..de77ba146f1b 100644 --- a/npm/.npmignore +++ b/npm/.npmignore @@ -1,2 +1,8 @@ dist/ path.txt +.npmignore +.travis.yml +appveyor.yml +CONTRIBUTING.md +issue_template.md +test/ From fb1a5a4646b9bb26cb988f3aa6737eaa97e88c1e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 19 Sep 2016 13:48:54 -0700 Subject: [PATCH 243/328] Only build master branch on Travis --- npm/.travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/npm/.travis.yml b/npm/.travis.yml index 9dbea0f239fb..74c248d30a9c 100644 --- a/npm/.travis.yml +++ b/npm/.travis.yml @@ -8,3 +8,6 @@ node_js: - '4' - '5' - '6' +branches: + only: + - master From 082c1da548bd2a0bc9449b61ee46fc1aa2fdb2b7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 19 Sep 2016 14:05:53 -0700 Subject: [PATCH 244/328] Add AppVeyor badge --- npm/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/npm/README.md b/npm/README.md index 8657b4c083b6..b649e2beee88 100644 --- a/npm/README.md +++ b/npm/README.md @@ -1,6 +1,7 @@ # electron-prebuilt -[![build status](http://img.shields.io/travis/electron-userland/electron-prebuilt.svg?style=flat)](http://travis-ci.org/electron-userland/electron-prebuilt) +[![Travis build status](http://img.shields.io/travis/electron-userland/electron-prebuilt.svg?style=flat)](http://travis-ci.org/electron-userland/electron-prebuilt) +[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/qd978ky9axl8m1m1?svg=true)](https://ci.appveyor.com/project/Atom/electron-prebuilt) [![badge](https://nodei.co/npm/electron-prebuilt.png?downloads=true)](https://www.npmjs.com/package/electron-prebuilt) From fb2f4ae5282a4c97fa445ec4868eecf13b97baca Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 19 Sep 2016 14:32:11 -0700 Subject: [PATCH 245/328] Set quiet to true when loglevel is silent --- npm/install.js | 8 +++++++- npm/package.json | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/npm/install.js b/npm/install.js index 5ec84203b8b8..1dcf5aff0afe 100755 --- a/npm/install.js +++ b/npm/install.js @@ -36,7 +36,13 @@ if (installedVersion === version && fs.existsSync(path.join(__dirname, paths[pla } // downloads if not cached -download({version: version, platform: process.env.npm_config_platform, arch: process.env.npm_config_arch, strictSSL: process.env.npm_config_strict_ssl === 'true'}, extractFile) +download({ + version: version, + platform: process.env.npm_config_platform, + arch: process.env.npm_config_arch, + strictSSL: process.env.npm_config_strict_ssl === 'true', + quiet: process.env.npm_config_loglevel === 'silent', +}, extractFile) // unzips and makes path.txt point at the correct executable function extractFile (err, zipPath) { diff --git a/npm/package.json b/npm/package.json index f0ef1742dd86..29bbe3410515 100644 --- a/npm/package.json +++ b/npm/package.json @@ -6,8 +6,8 @@ "scripts": { "cache-clean": "rm -rf ~/.electron && rm -rf dist", "postinstall": "node install.js", - "pretest": "npm run cache-clean && node install.js", - "test": "standard && tape test/*.js" + "pretest": "npm run cache-clean && npm --silent run postinstall", + "test": "tape test/*.js && standard" }, "bin": { "electron": "cli.js" From 557d062b7f6b430b5ad4343f89e771b13c448e84 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 19 Sep 2016 14:36:07 -0700 Subject: [PATCH 246/328] Remove trailing comma --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 1dcf5aff0afe..e6a273a5ad33 100755 --- a/npm/install.js +++ b/npm/install.js @@ -41,7 +41,7 @@ download({ platform: process.env.npm_config_platform, arch: process.env.npm_config_arch, strictSSL: process.env.npm_config_strict_ssl === 'true', - quiet: process.env.npm_config_loglevel === 'silent', + quiet: process.env.npm_config_loglevel === 'silent' }, extractFile) // unzips and makes path.txt point at the correct executable From 1fd1474c9a160439223e63711a19caead6aac323 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 19 Sep 2016 15:01:05 -0700 Subject: [PATCH 247/328] Install silently on Travis --- npm/.travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/npm/.travis.yml b/npm/.travis.yml index 74c248d30a9c..1d8c1a38f11e 100644 --- a/npm/.travis.yml +++ b/npm/.travis.yml @@ -11,3 +11,5 @@ node_js: branches: only: - master +install: + - npm --silent install From e6c0036726a4f16166369e9d0d9abae774605c1f Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 22 Sep 2016 04:25:46 -0700 Subject: [PATCH 248/328] Update to Electron v1.4.1 --- npm/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/package.json b/npm/package.json index cf1b6fd5d1c8..c282b5d08b76 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.0", + "version": "1.4.1", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { @@ -31,4 +31,4 @@ "keywords": [ "electron" ] -} +} \ No newline at end of file From 5ea143b08f836262e7dfdaa184f97a74d07a0cce Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 27 Sep 2016 03:03:26 -0700 Subject: [PATCH 249/328] Update to Electron v1.3.7 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index c282b5d08b76..97c269cb2285 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.1", + "version": "1.3.7", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 2227631b444d3b47d801d717bf4a4c6b83d1ab01 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Sep 2016 15:14:42 -0700 Subject: [PATCH 250/328] Upgrade to electron-download@3.0.1 --- npm/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/package.json b/npm/package.json index c282b5d08b76..d7647de776fc 100644 --- a/npm/package.json +++ b/npm/package.json @@ -15,7 +15,7 @@ "main": "index.js", "dependencies": { "extract-zip": "^1.0.3", - "electron-download": "^3.0.0" + "electron-download": "^3.0.1" }, "devDependencies": { "home-path": "^0.1.1", @@ -31,4 +31,4 @@ "keywords": [ "electron" ] -} \ No newline at end of file +} From 3ba3a84159d05244abf48d1604f378a57644d05d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Sep 2016 15:15:07 -0700 Subject: [PATCH 251/328] Remove unneeded silent option --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index d7647de776fc..8657f24e6816 100644 --- a/npm/package.json +++ b/npm/package.json @@ -6,7 +6,7 @@ "scripts": { "cache-clean": "rm -rf ~/.electron && rm -rf dist", "postinstall": "node install.js", - "pretest": "npm run cache-clean && npm --silent run postinstall", + "pretest": "npm run cache-clean && npm run postinstall", "test": "tape test/*.js && standard" }, "bin": { From 429ceeec23dcb72007eb98dd35568455af40b5d0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Sep 2016 15:16:33 -0700 Subject: [PATCH 252/328] Use default install script --- npm/.travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/npm/.travis.yml b/npm/.travis.yml index 1d8c1a38f11e..74c248d30a9c 100644 --- a/npm/.travis.yml +++ b/npm/.travis.yml @@ -11,5 +11,3 @@ node_js: branches: only: - master -install: - - npm --silent install From bc6ebd87dd141b61c0529e5a96041a68fa58bc35 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Fri, 30 Sep 2016 05:22:57 -0700 Subject: [PATCH 253/328] Update to Electron v1.4.2 --- npm/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/package.json b/npm/package.json index 3b911fcd7297..3ef9aaf3d845 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.3.7", + "version": "1.4.2", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { @@ -31,4 +31,4 @@ "keywords": [ "electron" ] -} +} \ No newline at end of file From 5a5d972a695b28c3e535c03b7174b4effa760437 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 6 Oct 2016 03:07:56 -0700 Subject: [PATCH 254/328] Update to Electron v1.4.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 3ef9aaf3d845..8101aea0a251 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.2", + "version": "1.4.3", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From f9f5854c5e6dbc1f2e220c342e6f4904010fd537 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 20 Oct 2016 11:23:41 +0900 Subject: [PATCH 255/328] Update to Electron v1.4.4 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 8101aea0a251..97da258e8ca3 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.3", + "version": "1.4.4", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 92818eb30fff12d6d1429259e1840d5f4e2f8035 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 20 Oct 2016 16:11:47 +0900 Subject: [PATCH 256/328] Update to Electron v1.3.8 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 97da258e8ca3..2aab9a95804d 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.4", + "version": "1.3.8", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 95cd9d718d2091d2dcfe6721d0b70f4807026b4e Mon Sep 17 00:00:00 2001 From: Flynn Joffray Date: Thu, 20 Oct 2016 12:20:25 +0100 Subject: [PATCH 257/328] print progress for proper loglevels --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 4482cfe063bb..58fec3459428 100755 --- a/npm/install.js +++ b/npm/install.js @@ -41,7 +41,7 @@ download({ platform: process.env.npm_config_platform, arch: process.env.npm_config_arch, strictSSL: process.env.npm_config_strict_ssl === 'true', - quiet: process.env.npm_config_loglevel === 'silent' + quiet: ['info', 'verbose', 'silly'].indexOf(process.env.npm_config_loglevel) === -1 }, extractFile) // unzips and makes path.txt point at the correct executable From 1846dfbbbbe25113c6c743893a60914d20576af6 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Wed, 2 Nov 2016 02:34:38 +0900 Subject: [PATCH 258/328] Update to Electron v1.4.5 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 2aab9a95804d..4c2aebe4f50e 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.3.8", + "version": "1.4.5", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From e3889e7035badc5d986da5bef87105ba5abeac75 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 10 Nov 2016 06:26:29 +0900 Subject: [PATCH 259/328] Update to Electron v1.4.6 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 4c2aebe4f50e..5f862f2c0461 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.5", + "version": "1.4.6", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 537203469ed189fbe626b0e3e1a357d346caefc6 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Fri, 11 Nov 2016 15:38:02 +0900 Subject: [PATCH 260/328] log level is missing http --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index 58fec3459428..07f7393e6c5c 100755 --- a/npm/install.js +++ b/npm/install.js @@ -41,7 +41,7 @@ download({ platform: process.env.npm_config_platform, arch: process.env.npm_config_arch, strictSSL: process.env.npm_config_strict_ssl === 'true', - quiet: ['info', 'verbose', 'silly'].indexOf(process.env.npm_config_loglevel) === -1 + quiet: ['info', 'verbose', 'silly', 'http'].indexOf(process.env.npm_config_loglevel) === -1 }, extractFile) // unzips and makes path.txt point at the correct executable From fd56129bb5375d48549766f1210aeafed431afed Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 17 Nov 2016 03:46:52 +0900 Subject: [PATCH 261/328] Update to Electron v1.4.7 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 5f862f2c0461..b0d698471dbc 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.6", + "version": "1.4.7", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From c94268a0feaf4ebccc9c62ed5d77fb7cfe707c8e Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 17 Nov 2016 05:57:00 +0900 Subject: [PATCH 262/328] Update to Electron v1.3.9 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index b0d698471dbc..d21816e3d7c4 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.7", + "version": "1.3.9", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From fb7718d700a4fcd9cab605210076de1dca74ae7d Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Wed, 23 Nov 2016 04:19:29 +0900 Subject: [PATCH 263/328] Update to Electron v1.3.10 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index d21816e3d7c4..426731db7eba 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.3.9", + "version": "1.3.10", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 7938f2b50d56a70759f84c618133a40d63427a3e Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Wed, 23 Nov 2016 08:46:12 +0900 Subject: [PATCH 264/328] Update to Electron v1.4.8 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 426731db7eba..2a22cdf770e7 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.3.10", + "version": "1.4.8", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 9518b66d73d88e2f44687dc8eb54eb7a01237ca0 Mon Sep 17 00:00:00 2001 From: Ivo von Putzer Reibegg Date: Wed, 23 Nov 2016 12:16:27 +0100 Subject: [PATCH 265/328] fixes typo within readme --- npm/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/README.md b/npm/README.md index b649e2beee88..b7e59e0891ed 100644 --- a/npm/README.md +++ b/npm/README.md @@ -104,7 +104,7 @@ binary. Use this to spawn Electron from Node scripts: var electron = require('electron') var proc = require('child_process') -// will something similar to print /Users/maf/.../Electron +// will print something similar to /Users/maf/.../Electron console.log(electron) // spawn Electron From 2420a3497c594f60d47b7849a39aa5470000d010 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 24 Nov 2016 07:07:19 +0900 Subject: [PATCH 266/328] Update to Electron v1.3.11 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 2a22cdf770e7..339a2dd32ec5 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.8", + "version": "1.3.11", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 8ba43b4e5b7dfce27e75f28b4c81c66e0b3cd16b Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 24 Nov 2016 08:50:47 +0900 Subject: [PATCH 267/328] Update to Electron v1.4.9 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 339a2dd32ec5..c53dc59d8bfc 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.3.11", + "version": "1.4.9", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 02f55b2d911027dca7b096d360d3b0c59df29dc0 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 29 Nov 2016 05:49:21 +0900 Subject: [PATCH 268/328] Update to Electron v1.3.12 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index c53dc59d8bfc..b985d0466d98 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.9", + "version": "1.3.12", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From bfcca60ac3f5729073ee6da4b5d690b7b6d59ef6 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 29 Nov 2016 07:12:53 +0900 Subject: [PATCH 269/328] Update to Electron v1.4.10 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index b985d0466d98..a5efdd002c5b 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.3.12", + "version": "1.4.10", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 9d9266af66f45cdcb573b5931dd6f295572514c9 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 6 Dec 2016 15:53:10 -0800 Subject: [PATCH 270/328] Update to Electron v1.3.13 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index a5efdd002c5b..f9eae7ae030a 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.10", + "version": "1.3.13", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 4ac270761f40c907d0009ab777e6dd630d621d20 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Wed, 7 Dec 2016 10:03:33 -0800 Subject: [PATCH 271/328] Update to Electron v1.4.11 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index f9eae7ae030a..b57d1f982757 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.3.13", + "version": "1.4.11", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 8c9c7f8fbec8e685c4505c7b82c1d2b38e32c187 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Fri, 9 Dec 2016 22:47:23 -0800 Subject: [PATCH 272/328] Update to Electron v1.4.12 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index b57d1f982757..ba5eebce5fca 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.11", + "version": "1.4.12", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 0f8ba64aa25b6047f8a34a1375edebfc7ccdc5ac Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Fri, 9 Dec 2016 22:55:28 -0800 Subject: [PATCH 273/328] Update to Electron v1.4.12 From f405b2e366a17c6f8484eceb92f445b6400a8639 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 20 Dec 2016 13:09:17 -0800 Subject: [PATCH 274/328] Update to Electron v1.4.13 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index ba5eebce5fca..98a9a71497f8 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.12", + "version": "1.4.13", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From d2df641b0d23fd1f709b71e28026b2dedb39f672 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Dec 2016 11:03:51 -0800 Subject: [PATCH 275/328] Write path.txt after extraction --- npm/install.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/install.js b/npm/install.js index 07f7393e6c5c..afcff4031c27 100755 --- a/npm/install.js +++ b/npm/install.js @@ -47,9 +47,9 @@ download({ // unzips and makes path.txt point at the correct executable function extractFile (err, zipPath) { if (err) return onerror(err) - fs.writeFile(path.join(__dirname, 'path.txt'), paths[platform], function (err) { + extract(zipPath, {dir: path.join(__dirname, 'dist')}, function (err) { if (err) return onerror(err) - extract(zipPath, {dir: path.join(__dirname, 'dist')}, function (err) { + fs.writeFile(path.join(__dirname, 'path.txt'), paths[platform], function (err) { if (err) return onerror(err) }) }) From d5bb1d87ccdf3cc19de80f0c700891a71c15ced0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Dec 2016 11:13:15 -0800 Subject: [PATCH 276/328] Add getPath helper --- npm/install.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/npm/install.js b/npm/install.js index afcff4031c27..ea87df88a13b 100755 --- a/npm/install.js +++ b/npm/install.js @@ -22,16 +22,23 @@ function onerror (err) { throw err } -var paths = { - darwin: 'dist/Electron.app/Contents/MacOS/Electron', - freebsd: 'dist/electron', - linux: 'dist/electron', - win32: 'dist/electron.exe' +function getPath (platform) { + switch (platform) { + case 'darwin': + return 'dist/Electron.app/Contents/MacOS/Electron' + case 'freebsd': + case 'linux': + return 'dist/electron' + case 'win32': + return 'dist/electron.exe' + default: + throw new Error('Electron builds are not available on platform: ' + platform) + } } -if (!paths[platform]) throw new Error('Electron builds are not available on platform: ' + platform) +var platformPath = getPath(platform) -if (installedVersion === version && fs.existsSync(path.join(__dirname, paths[platform]))) { +if (installedVersion === version && fs.existsSync(path.join(__dirname, platformPath))) { process.exit(0) } @@ -49,7 +56,7 @@ function extractFile (err, zipPath) { if (err) return onerror(err) extract(zipPath, {dir: path.join(__dirname, 'dist')}, function (err) { if (err) return onerror(err) - fs.writeFile(path.join(__dirname, 'path.txt'), paths[platform], function (err) { + fs.writeFile(path.join(__dirname, 'path.txt'), platformPath, function (err) { if (err) return onerror(err) }) }) From af2ca221b4f8e60e445d5085c09a95a33f3c560e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Dec 2016 11:21:18 -0800 Subject: [PATCH 277/328] Ignore npm-debug.log --- npm/.gitignore | 1 + npm/.npmignore | 1 + 2 files changed, 2 insertions(+) diff --git a/npm/.gitignore b/npm/.gitignore index 9ec0c37f1d7a..6424611f74c1 100644 --- a/npm/.gitignore +++ b/npm/.gitignore @@ -2,3 +2,4 @@ node_modules dist path.txt .DS_Store +npm-debug.log diff --git a/npm/.npmignore b/npm/.npmignore index de77ba146f1b..9d10d49cbab1 100644 --- a/npm/.npmignore +++ b/npm/.npmignore @@ -6,3 +6,4 @@ appveyor.yml CONTRIBUTING.md issue_template.md test/ +npm-debug.log From 835c64b7b2e5002ca27e5f96831d38d6bd92eb23 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Dec 2016 11:37:01 -0800 Subject: [PATCH 278/328] Add specs for error cases --- npm/test/errors.js | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 npm/test/errors.js diff --git a/npm/test/errors.js b/npm/test/errors.js new file mode 100644 index 000000000000..1c86a44bec5e --- /dev/null +++ b/npm/test/errors.js @@ -0,0 +1,62 @@ +var fs = require('fs') +var tape = require('tape') +var path = require('path') +var childProcess = require('child_process') + +tape('fails for unsupported platforms', function (t) { + install({npm_config_platform: 'android'}, function (code, stderr) { + t.notEqual(stderr.indexOf('Electron builds are not available on platform: android'), -1, 'has error message') + t.equal(code, 1, 'exited with 1') + t.end() + }) +}) + +tape('fails for unknown architectures', function (t) { + install({ + npm_config_arch: 'midcentury', + npm_config_platform: 'win32', + HOME: process.env.HOME, + USERPROFILE: process.env.USERPROFILE + }, function (code, stderr) { + t.notEqual(stderr.indexOf('Failed to find Electron'), -1, 'has error message') + t.notEqual(stderr.indexOf('win32-midcentury'), -1, 'has error message') + t.equal(code, 1, 'exited with 1') + t.end() + }) +}) + +var install = function (env, callback) { + removeVersionFile() + + var installPath = path.join(__dirname, '..', 'install.js') + var installProcess = childProcess.fork(installPath, { + silent: true, + env: env + }) + + var stderr = '' + installProcess.stderr.on('data', function (data) { + stderr += data + }) + + installProcess.on('close', function (code) { + restoreVersionFile() + callback(code, stderr) + }) +} + +var versionPath = path.join(__dirname, '..', 'dist', 'version') +var versionContents = null +function removeVersionFile () { + if (fs.existsSync(versionPath)) { + versionContents = fs.readFileSync(versionPath) + fs.unlinkSync(versionPath) + } +} + +function restoreVersionFile () { + if (versionContents != null) { + fs.writeFileSync(versionPath, versionContents) + versionContents = null + } +} From ed8260e4d9b1ce3be9bee8419a3e733ccbbb5249 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Dec 2016 11:48:14 -0800 Subject: [PATCH 279/328] Inline platform variable --- npm/install.js | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/npm/install.js b/npm/install.js index ea87df88a13b..a0c1d3f0ccd3 100755 --- a/npm/install.js +++ b/npm/install.js @@ -16,27 +16,7 @@ try { // do nothing } -var platform = process.env.npm_config_platform || os.platform() - -function onerror (err) { - throw err -} - -function getPath (platform) { - switch (platform) { - case 'darwin': - return 'dist/Electron.app/Contents/MacOS/Electron' - case 'freebsd': - case 'linux': - return 'dist/electron' - case 'win32': - return 'dist/electron.exe' - default: - throw new Error('Electron builds are not available on platform: ' + platform) - } -} - -var platformPath = getPath(platform) +var platformPath = getPlatformPath() if (installedVersion === version && fs.existsSync(path.join(__dirname, platformPath))) { process.exit(0) @@ -61,3 +41,23 @@ function extractFile (err, zipPath) { }) }) } + +function onerror (err) { + throw err +} + +function getPlatformPath () { + var platform = process.env.npm_config_platform || os.platform() + + switch (platform) { + case 'darwin': + return 'dist/Electron.app/Contents/MacOS/Electron' + case 'freebsd': + case 'linux': + return 'dist/electron' + case 'win32': + return 'dist/electron.exe' + default: + throw new Error('Electron builds are not available on platform: ' + platform) + } +} From 8d4660158ac46080a3253da20c19475a378ff252 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Dec 2016 11:49:44 -0800 Subject: [PATCH 280/328] err -> ignored --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index a0c1d3f0ccd3..7a41a4e83316 100755 --- a/npm/install.js +++ b/npm/install.js @@ -12,7 +12,7 @@ var download = require('electron-download') var installedVersion = null try { installedVersion = fs.readFileSync(path.join(__dirname, 'dist', 'version'), 'utf-8').replace(/^v/, '') -} catch (err) { +} catch (ignored) { // do nothing } From e165294ff1643537a118ee0776351d69e58b94a2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Dec 2016 13:20:51 -0800 Subject: [PATCH 281/328] Check that exit code was non-zero --- npm/test/errors.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/test/errors.js b/npm/test/errors.js index 1c86a44bec5e..abc5d15b6c2d 100644 --- a/npm/test/errors.js +++ b/npm/test/errors.js @@ -6,7 +6,7 @@ var childProcess = require('child_process') tape('fails for unsupported platforms', function (t) { install({npm_config_platform: 'android'}, function (code, stderr) { t.notEqual(stderr.indexOf('Electron builds are not available on platform: android'), -1, 'has error message') - t.equal(code, 1, 'exited with 1') + t.notEqual(code, 0, 'exited with error') t.end() }) }) @@ -20,7 +20,7 @@ tape('fails for unknown architectures', function (t) { }, function (code, stderr) { t.notEqual(stderr.indexOf('Failed to find Electron'), -1, 'has error message') t.notEqual(stderr.indexOf('win32-midcentury'), -1, 'has error message') - t.equal(code, 1, 'exited with 1') + t.notEqual(code, 0, 'exited with error') t.end() }) }) From 5c8ebb296c017252bbeee52304c07833e30c8804 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Tue, 27 Dec 2016 12:17:48 +1300 Subject: [PATCH 282/328] Update index.js --- npm/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/npm/index.js b/npm/index.js index 74b576ef9fe3..a49932aa2027 100644 --- a/npm/index.js +++ b/npm/index.js @@ -1,4 +1,10 @@ var fs = require('fs') var path = require('path') -module.exports = path.join(__dirname, fs.readFileSync(path.join(__dirname, 'path.txt'), 'utf-8')) +const pathFile = path.join(__dirname, 'path.txt') + +if (fs.existsSync(pathFile)) { + module.exports = path.join(__dirname, fs.readFileSync(pathFile, 'utf-8')) +} else { + throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again'); +} From b85ec95975e3ff997c7b5c4749e1ea0d93057dbc Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Tue, 27 Dec 2016 19:26:05 +1300 Subject: [PATCH 283/328] Get package name from folder path --- npm/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/index.js b/npm/index.js index a49932aa2027..0e338620a0c3 100644 --- a/npm/index.js +++ b/npm/index.js @@ -1,10 +1,10 @@ var fs = require('fs') var path = require('path') -const pathFile = path.join(__dirname, 'path.txt') +var pathFile = path.join(__dirname, 'path.txt') if (fs.existsSync(pathFile)) { module.exports = path.join(__dirname, fs.readFileSync(pathFile, 'utf-8')) } else { - throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again'); + throw new Error('Electron failed to install correctly, please delete node_modules/' + path.basename(__dirname) + ' and try installing again'); } From e3e05aa79725b043b7ae10e1c162f429fb0f2c8e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 28 Dec 2016 09:28:51 -0800 Subject: [PATCH 284/328] Add test for corrupt install error message --- npm/test/errors.js | 56 +++++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/npm/test/errors.js b/npm/test/errors.js index abc5d15b6c2d..69ccd7a2fa5c 100644 --- a/npm/test/errors.js +++ b/npm/test/errors.js @@ -3,7 +3,7 @@ var tape = require('tape') var path = require('path') var childProcess = require('child_process') -tape('fails for unsupported platforms', function (t) { +tape('install fails for unsupported platforms', function (t) { install({npm_config_platform: 'android'}, function (code, stderr) { t.notEqual(stderr.indexOf('Electron builds are not available on platform: android'), -1, 'has error message') t.notEqual(code, 0, 'exited with error') @@ -11,7 +11,7 @@ tape('fails for unsupported platforms', function (t) { }) }) -tape('fails for unknown architectures', function (t) { +tape('install fails for unsupported architectures', function (t) { install({ npm_config_arch: 'midcentury', npm_config_platform: 'win32', @@ -25,8 +25,16 @@ tape('fails for unknown architectures', function (t) { }) }) -var install = function (env, callback) { - removeVersionFile() +tape('require fails for corrupted installs', function (t) { + cli(function (code, stderr) { + t.notEqual(stderr.indexOf('Electron failed to install correctly'), -1, 'has error message') + t.notEqual(code, 0, 'exited with error') + t.end() + }) +}) + +function install (env, callback) { + var restoreFile = removeFile(path.join(__dirname, '..', 'dist', 'version')) var installPath = path.join(__dirname, '..', 'install.js') var installProcess = childProcess.fork(installPath, { @@ -40,23 +48,39 @@ var install = function (env, callback) { }) installProcess.on('close', function (code) { - restoreVersionFile() + restoreFile() callback(code, stderr) }) } -var versionPath = path.join(__dirname, '..', 'dist', 'version') -var versionContents = null -function removeVersionFile () { - if (fs.existsSync(versionPath)) { - versionContents = fs.readFileSync(versionPath) - fs.unlinkSync(versionPath) - } +function cli (callback) { + var restoreFile = removeFile(path.join(__dirname, '..', 'path.txt')) + + var cliPath = path.join(__dirname, '..', 'cli.js') + var cliProcess = childProcess.fork(cliPath, { + silent: true + }) + + var stderr = '' + cliProcess.stderr.on('data', function (data) { + stderr += data + }) + + cliProcess.on('close', function (code) { + restoreFile() + callback(code, stderr) + }) } -function restoreVersionFile () { - if (versionContents != null) { - fs.writeFileSync(versionPath, versionContents) - versionContents = null +function removeFile (filePath) { + var contents = null + if (fs.existsSync(filePath)) { + contents = fs.readFileSync(filePath) + fs.unlinkSync(filePath) + } + return function restoreFile () { + if (contents != null) { + fs.writeFileSync(filePath, contents) + } } } From d9d47344c1d2f5524a52e5c660192fae633e6d15 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 28 Dec 2016 09:29:37 -0800 Subject: [PATCH 285/328] Remove semicolon --- npm/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/index.js b/npm/index.js index 0e338620a0c3..ac3de3846d9f 100644 --- a/npm/index.js +++ b/npm/index.js @@ -6,5 +6,5 @@ var pathFile = path.join(__dirname, 'path.txt') if (fs.existsSync(pathFile)) { module.exports = path.join(__dirname, fs.readFileSync(pathFile, 'utf-8')) } else { - throw new Error('Electron failed to install correctly, please delete node_modules/' + path.basename(__dirname) + ' and try installing again'); + throw new Error('Electron failed to install correctly, please delete node_modules/' + path.basename(__dirname) + ' and try installing again') } From f89157fff9aebdc4240aeebfcb1174070c64dc85 Mon Sep 17 00:00:00 2001 From: Peter Schmidt Date: Wed, 4 Jan 2017 18:15:01 +1100 Subject: [PATCH 286/328] Update README.md badge: Drop prebuilt As documented later in the README.md already, plus the download numbers look bigger too. --- npm/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/README.md b/npm/README.md index b7e59e0891ed..2d0c5b27edb6 100644 --- a/npm/README.md +++ b/npm/README.md @@ -3,7 +3,7 @@ [![Travis build status](http://img.shields.io/travis/electron-userland/electron-prebuilt.svg?style=flat)](http://travis-ci.org/electron-userland/electron-prebuilt) [![AppVeyor build status](https://ci.appveyor.com/api/projects/status/qd978ky9axl8m1m1?svg=true)](https://ci.appveyor.com/project/Atom/electron-prebuilt) -[![badge](https://nodei.co/npm/electron-prebuilt.png?downloads=true)](https://www.npmjs.com/package/electron-prebuilt) +[![badge](https://nodei.co/npm/electron.png?downloads=true)](https://www.npmjs.com/package/electron) Install [Electron](https://github.com/electron/electron) prebuilt binaries for command-line use using npm. This module helps you easily install the `electron` From fe1cfa27fe3524dd35b53e924323868c086c3881 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 10 Jan 2017 12:45:08 -0800 Subject: [PATCH 287/328] Update to Electron v1.4.14 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 98a9a71497f8..d22cf1812f26 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.13", + "version": "1.4.14", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 32039ef9a61f4e7cc1269cf0c6aa3edc4fc20e9a Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 19 Jan 2017 10:10:28 -0800 Subject: [PATCH 288/328] Update to Electron v1.4.15 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index d22cf1812f26..f196bd09de39 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.14", + "version": "1.4.15", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From e534e8623e85471596b147b711b2cde409d9d805 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 24 Jan 2017 10:20:22 -0800 Subject: [PATCH 289/328] Update to Electron v1.5.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index f196bd09de39..62d4ee33948a 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.15", + "version": "1.5.0", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 381f8ffae710fc5e3c022ebc0c5c42c81040516c Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Mon, 6 Feb 2017 10:00:16 -0800 Subject: [PATCH 290/328] Update to Electron v1.5.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 62d4ee33948a..525b7ec9554a 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.5.0", + "version": "1.5.1", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 73e753ef9ab9664695fc3a02d4edfc802fe31e48 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Mon, 6 Feb 2017 18:23:20 -0800 Subject: [PATCH 291/328] Update to Electron v1.6.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 525b7ec9554a..b64b178b0f32 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.5.1", + "version": "1.6.0", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 24ef8cc8ced46aa459e1daf5961a236071e51ade Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Wed, 8 Feb 2017 11:36:38 -0800 Subject: [PATCH 292/328] hardcode module path in error message --- npm/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/index.js b/npm/index.js index ac3de3846d9f..eb480b9e01dd 100644 --- a/npm/index.js +++ b/npm/index.js @@ -6,5 +6,5 @@ var pathFile = path.join(__dirname, 'path.txt') if (fs.existsSync(pathFile)) { module.exports = path.join(__dirname, fs.readFileSync(pathFile, 'utf-8')) } else { - throw new Error('Electron failed to install correctly, please delete node_modules/' + path.basename(__dirname) + ' and try installing again') + throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again') } From ba39adde36b3ac7463ad180bf3ef43b71dcdc38c Mon Sep 17 00:00:00 2001 From: Volodymyr Bezuglyy Date: Thu, 9 Feb 2017 15:15:15 +0200 Subject: [PATCH 293/328] Use process.env.electron_config_cache to get prepared zip file. --- npm/install.js | 1 + 1 file changed, 1 insertion(+) diff --git a/npm/install.js b/npm/install.js index 7a41a4e83316..7ffc429a0bf1 100755 --- a/npm/install.js +++ b/npm/install.js @@ -24,6 +24,7 @@ if (installedVersion === version && fs.existsSync(path.join(__dirname, platformP // downloads if not cached download({ + cache: process.env.electron_config_cache, version: version, platform: process.env.npm_config_platform, arch: process.env.npm_config_arch, From 353920e1faa2852a62015f919de07b61727a1ee5 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 21 Feb 2017 10:24:28 -0800 Subject: [PATCH 294/328] Update to Electron v1.6.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index b64b178b0f32..7d5ad51a3311 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.6.0", + "version": "1.6.1", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 91c778d053a507c9d357da8ddf7baa2b7993d638 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Wed, 1 Mar 2017 12:06:40 -0800 Subject: [PATCH 295/328] Update to Electron v1.6.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 7d5ad51a3311..ec1816b7e2f2 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.6.1", + "version": "1.6.2", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From cc6c12b783049de6aafa3d663f49bfcf78ccda3c Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 7 Mar 2017 11:32:34 -0800 Subject: [PATCH 296/328] Update to Electron v1.6.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index ec1816b7e2f2..2a2ff64c99a1 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.6.2", + "version": "1.6.3", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 1c9b0c57ffaf2bebc8570b602ca6e88d763ff5f4 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 14 Mar 2017 10:10:46 -0700 Subject: [PATCH 297/328] Update AppVeyor badge URL --- npm/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/README.md b/npm/README.md index 2d0c5b27edb6..f9c079b55dad 100644 --- a/npm/README.md +++ b/npm/README.md @@ -1,7 +1,7 @@ # electron-prebuilt [![Travis build status](http://img.shields.io/travis/electron-userland/electron-prebuilt.svg?style=flat)](http://travis-ci.org/electron-userland/electron-prebuilt) -[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/qd978ky9axl8m1m1?svg=true)](https://ci.appveyor.com/project/Atom/electron-prebuilt) +[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/hxcd9vcdn9hr0b3y/branch/master?svg=true)](https://ci.appveyor.com/project/electron-bot/electron-prebuilt/branch/master) [![badge](https://nodei.co/npm/electron.png?downloads=true)](https://www.npmjs.com/package/electron) From 43cccff957658f9ac222eed47c31d7b5798f3e4c Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 14 Mar 2017 11:47:48 -0700 Subject: [PATCH 298/328] Update to Electron v1.3.14 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 2a2ff64c99a1..0c340112ca80 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.6.3", + "version": "1.3.14", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 9eb00a462b12db9de7315ffd8afeb788cd30fdeb Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Wed, 22 Mar 2017 16:06:04 -0700 Subject: [PATCH 299/328] Update to Electron v1.6.4 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 0c340112ca80..23332a86bebf 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.3.14", + "version": "1.6.4", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 361dc1faffac2bfde5ee326db772b1e98548e478 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Fri, 31 Mar 2017 13:32:08 -0700 Subject: [PATCH 300/328] Update to Electron v1.6.5 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 23332a86bebf..73441a8fe2b0 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.6.4", + "version": "1.6.5", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From bf22f50aebdb9e7545f88fc80080ba16c709c65e Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Wed, 5 Apr 2017 10:34:16 -0700 Subject: [PATCH 301/328] Update to Electron v1.4.16 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 73441a8fe2b0..b74b54f51858 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.6.5", + "version": "1.4.16", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From a2d6c231e04f1e34654ff0cf228a27f542ba7bd9 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Fri, 7 Apr 2017 13:04:07 -0700 Subject: [PATCH 302/328] Update to Electron v1.6.6 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index b74b54f51858..d9c9106db737 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.4.16", + "version": "1.6.6", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 26a28b744707637b53af9658c47067f3a36c75a9 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 18 Apr 2017 13:58:20 -0700 Subject: [PATCH 303/328] Update to Electron v1.6.7 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index d9c9106db737..8af0db7e7657 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.6.6", + "version": "1.6.7", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 703dbb22e26da7511d37ebe9373a45d5bc9de0ee Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 20 Apr 2017 17:04:43 -0700 Subject: [PATCH 304/328] Update to Electron v1.3.15 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 8af0db7e7657..e3cb35a3325f 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.6.7", + "version": "1.3.15", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From b0b5fef3175d07e5ce4263acf657a70f8c4d74b3 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Mon, 1 May 2017 15:56:30 -0700 Subject: [PATCH 305/328] Update to Electron v1.6.8 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index e3cb35a3325f..79b08a8858e6 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.3.15", + "version": "1.6.8", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 3f74a2ab482e173cda37a6d890789498b8642dd1 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Mon, 7 Nov 2016 13:57:41 -0800 Subject: [PATCH 306/328] add electron.d.ts file and reference in package.json --- npm/electron.d.ts | 4579 +++++++++++++++++++++++++++++++++++++++++++++ npm/package.json | 3 +- 2 files changed, 4581 insertions(+), 1 deletion(-) create mode 100644 npm/electron.d.ts diff --git a/npm/electron.d.ts b/npm/electron.d.ts new file mode 100644 index 000000000000..05debc16dcee --- /dev/null +++ b/npm/electron.d.ts @@ -0,0 +1,4579 @@ +// Type definitions for Electron 0.0.6 +// Project: http://electron.atom.io/ + + +declare namespace Electron { + class EventEmitter extends NodeJS.EventEmitter { + addListener(event: string, listener: Function): this; + on(event: string, listener: Function): this; + once(event: string, listener: Function): this; + removeListener(event: string, listener: Function): this; + removeAllListeners(event?: string): this; + setMaxListeners(n: number): this; + getMaxListeners(): number; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; + } + + class Accelerator extends String { + + } + + /** + * DownloadItem represents a download item in Electron. + */ + interface DownloadItem extends NodeJS.EventEmitter { + /** + * Emitted when the download has been updated and is not done. + */ + on(event: 'updated', listener: (event: Event, state: 'progressing' | 'interrupted') => void): this; + /** + * Emits when the download is in a terminal state. This includes a completed download, + * a cancelled download (via downloadItem.cancel()), and interrupted download that can’t be resumed. + */ + on(event: 'done', listener: (event: Event, state: 'completed' | 'cancelled' | 'interrupted') => void): this; + on(event: string, listener: Function): this; + /** + * Set the save file path of the download item. + * Note: The API is only available in session’s will-download callback function. + * If user doesn’t set the save path via the API, Electron will use the original + * routine to determine the save path (Usually prompts a save dialog). + */ + setSavePath(path: string): void; + /** + * @returns The save path of the download item. + * This will be either the path set via downloadItem.setSavePath(path) or the path selected from the shown save dialog. + */ + getSavePath(): string; + /** + * Pauses the download. + */ + pause(): void; + /** + * @returns Whether the download is paused. + */ + isPaused(): boolean; + /** + * Resumes the download that has been paused. + */ + resume(): void; + /** + * @returns Whether the download can resume. + */ + canResume(): boolean; + /** + * Cancels the download operation. + */ + cancel(): void; + /** + * @returns The origin url where the item is downloaded from. + */ + getURL(): string; + /** + * @returns The mime type. + */ + getMimeType(): string; + /** + * @returns Whether the download has user gesture. + */ + hasUserGesture(): boolean; + /** + * @returns The file name of the download item. + * Note: The file name is not always the same as the actual one saved in local disk. + * If user changes the file name in a prompted download saving dialog, + * the actual name of saved file will be different. + */ + getFilename(): string; + /** + * @returns The total size in bytes of the download item. If the size is unknown, it returns 0. + */ + getTotalBytes(): number; + /** + * @returns The received bytes of the download item. + */ + getReceivedBytes(): number; + /** + * @returns The Content-Disposition field from the response header. + */ + getContentDisposition(): string; + /** + * @returns The current state. + */ + getState(): 'progressing' | 'completed' | 'cancelled' | 'interrupted'; + } + + interface Event { + preventDefault: Function; + sender: WebContents; + returnValue?: any; + } + + interface CommonInterface { + clipboard: Electron.Clipboard; + crashReporter: Electron.CrashReporter; + nativeImage: typeof Electron.NativeImage; + NativeImage: typeof Electron.NativeImage; + shell: Electron.Shell; + screen: Electron.Screen; + BluetoothDevice: Electron.BluetoothDevice; + Certificate: Electron.Certificate; + Cookie: Electron.Cookie; + DesktopCapturerSource: Electron.DesktopCapturerSource; + Display: Electron.Display; + JumpListCategory: Electron.JumpListCategory; + JumpListItem: Electron.JumpListItem; + MemoryUsageDetails: Electron.MemoryUsageDetails; + Rectangle: Electron.Rectangle; + ShortcutDetails: Electron.ShortcutDetails; + Task: Electron.Task; + ThumbarButton: Electron.ThumbarButton; + UploadData: Electron.UploadData; + } + + interface MainInterface extends CommonInterface { + app: Electron.App; + autoUpdater: Electron.AutoUpdater; + BrowserWindow: typeof Electron.BrowserWindow; + contentTracing: Electron.ContentTracing; + dialog: Electron.Dialog; + ipcMain: Electron.IpcMain; + globalShortcut: Electron.GlobalShortcut; + Menu: typeof Electron.Menu; + net: Electron.Net; + ClientRequest: typeof Electron.ClientRequest; + IncomingMessage: typeof Electron.IncomingMessage; + MenuItem: typeof Electron.MenuItem; + powerMonitor: Electron.PowerMonitor; + powerSaveBlocker: Electron.PowerSaveBlocker; + protocol: Electron.Protocol; + session: typeof Electron.Session; + Session: typeof Electron.Session; + Cookies: typeof Electron.Cookies; + WebRequest: typeof Electron.WebRequest; + systemPreferences: Electron.SystemPreferences; + Tray: typeof Electron.Tray; + webContents: typeof Electron.WebContents; + WebContents: typeof Electron.WebContents; + Debugger: typeof Electron.Debugger; + process: Electron.Process; + } + + interface RendererInterface extends CommonInterface { + desktopCapturer: Electron.DesktopCapturer; + ipcRenderer: Electron.IpcRenderer; + remote: Electron.Remote; + webFrame: Electron.WebFrame; + BrowserWindowProxy: typeof Electron.BrowserWindowProxy; + } + + interface AllElectron { + clipboard: Electron.Clipboard; + crashReporter: Electron.CrashReporter; + nativeImage: typeof Electron.NativeImage; + shell: Electron.Shell; + app: Electron.App; + autoUpdater: Electron.AutoUpdater; + BrowserWindow: typeof Electron.BrowserWindow; + contentTracing: Electron.ContentTracing; + dialog: Electron.Dialog; + ipcMain: Electron.IpcMain; + globalShortcut: Electron.GlobalShortcut; + Menu: typeof Electron.Menu; + net: Electron.Net; + ClientRequest: typeof Electron.ClientRequest; + IncomingMessage: typeof Electron.IncomingMessage; + MenuItem: typeof Electron.MenuItem; + powerMonitor: Electron.PowerMonitor; + powerSaveBlocker: Electron.PowerSaveBlocker; + protocol: Electron.Protocol; + screen: Electron.Screen; + session: typeof Electron.Session; + Cookies: typeof Electron.Cookies; + WebRequest: typeof Electron.WebRequest; + systemPreferences: Electron.SystemPreferences; + Tray: typeof Electron.Tray; + webContents: typeof Electron.WebContents; + Debugger: typeof Electron.Debugger; + process: Electron.Process; + desktopCapturer: Electron.DesktopCapturer; + ipcRenderer: Electron.IpcRenderer; + remote: Electron.Remote; + webFrame: Electron.WebFrame; + BrowserWindowProxy: typeof Electron.BrowserWindowProxy; + BluetoothDevice: Electron.BluetoothDevice; + Certificate: Electron.Certificate; + Cookie: Electron.Cookie; + DesktopCapturerSource: Electron.DesktopCapturerSource; + Display: Electron.Display; + JumpListCategory: Electron.JumpListCategory; + JumpListItem: Electron.JumpListItem; + MemoryUsageDetails: Electron.MemoryUsageDetails; + Rectangle: Electron.Rectangle; + ShortcutDetails: Electron.ShortcutDetails; + Task: Electron.Task; + ThumbarButton: Electron.ThumbarButton; + UploadData: Electron.UploadData; + } + + interface App extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/app + + /** + * Emitted when Chrome's accessibility support changes. This event fires when + * assistive technologies, such as screen readers, are enabled or disabled. See + * https://www.chromium.org/developers/design-documents/accessibility for more + * details. + */ + on(event: 'accessibility-support-changed', listener: (event: Event, + /** + * `true` when Chrome's accessibility support is enabled, `false` otherwise. + */ + accessibilitySupportEnabled: boolean) => void): this; + /** + * Emitted when the application is activated, which usually happens when the user + * clicks on the application's dock icon. + */ + on(event: 'activate', listener: (event: Event, + hasVisibleWindows: boolean) => void): this; + /** + * Emitted before the application starts closing its windows. Calling + * event.preventDefault() will prevent the default behaviour, which is terminating + * the application. + */ + on(event: 'before-quit', listener: (event: Event) => void): this; + /** + * Emitted when a browserWindow gets blurred. + */ + on(event: 'browser-window-blur', listener: (event: Event, + window: BrowserWindow) => void): this; + /** + * Emitted when a new browserWindow is created. + */ + on(event: 'browser-window-created', listener: (event: Event, + window: BrowserWindow) => void): this; + /** + * Emitted when a browserWindow gets focused. + */ + on(event: 'browser-window-focus', listener: (event: Event, + window: BrowserWindow) => void): this; + /** + * Emitted when failed to verify the certificate for url, to trust the certificate + * you should prevent the default behavior with event.preventDefault() and call + * callback(true). + */ + on(event: 'certificate-error', listener: (event: Event, + webContents: WebContents, + url: URL, + /** + * The error code + */ + error: string, + certificate: Certificate, + callback: Function) => void): this; + /** + * Emitted during Handoff when an activity from a different device wants to be + * resumed. You should call event.preventDefault() if you want to handle this + * event. A user activity can be continued only in an app that has the same + * developer Team ID as the activity's source app and that supports the activity's + * type. Supported activity types are specified in the app's Info.plist under the + * NSUserActivityTypes key. + */ + on(event: 'continue-activity', listener: (event: Event, + /** + * A string identifying the activity. Maps to . + */ + type: string, + /** + * Contains app-specific state stored by the activity on another device. + */ + userInfo: any) => void): this; + /** + * Emitted when the gpu process crashes or is killed. + */ + on(event: 'gpu-process-crashed', listener: (event: Event, + killed: boolean) => void): this; + /** + * Emitted when webContents wants to do basic auth. The default behavior is to + * cancel all authentications, to override this you should prevent the default + * behavior with event.preventDefault() and call callback(username, password) with + * the credentials. + */ + on(event: 'login', listener: (event: Event, + webContents: WebContents, + request: Request, + authInfo: AuthInfo, + callback: Function) => void): this; + /** + * Emitted when the user wants to open a file with the application. The open-file + * event is usually emitted when the application is already open and the OS wants + * to reuse the application to open the file. open-file is also emitted when a file + * is dropped onto the dock and the application is not yet running. Make sure to + * listen for the open-file event very early in your application startup to handle + * this case (even before the ready event is emitted). You should call + * event.preventDefault() if you want to handle this event. On Windows, you have to + * parse process.argv (in the main process) to get the filepath. + */ + on(event: 'open-file', listener: (event: Event, + path: string) => void): this; + /** + * Emitted when the user wants to open a URL with the application. The URL scheme + * must be registered to be opened by your application. You should call + * event.preventDefault() if you want to handle this event. + */ + on(event: 'open-url', listener: (event: Event, + url: string) => void): this; + /** + * Emitted when the application is quitting. + */ + on(event: 'quit', listener: (event: Event, + exitCode: number) => void): this; + /** + * Emitted when Electron has finished initializing. On macOS, launchInfo holds the + * userInfo of the NSUserNotification that was used to open the application, if it + * was launched from Notification Center. You can call app.isReady() to check if + * this event has already fired. + */ + on(event: 'ready', listener: (launchInfo: any) => void): this; + /** + * Emitted when a client certificate is requested. The url corresponds to the + * navigation entry requesting the client certificate and callback needs to be + * called with an entry filtered from the list. Using event.preventDefault() + * prevents the application from using the first certificate from the store. + */ + on(event: 'select-client-certificate', listener: (event: Event, + webContents: WebContents, + url: URL, + certificateList: Certificate[], + callback: Function) => void): this; + /** + * Emitted when a new webContents is created. + */ + on(event: 'web-contents-created', listener: (event: Event, + webContents: WebContents) => void): this; + /** + * Emitted when the application has finished basic startup. On Windows and Linux, + * the will-finish-launching event is the same as the ready event; on macOS, this + * event represents the applicationWillFinishLaunching notification of + * NSApplication. You would usually set up listeners for the open-file and open-url + * events here, and start the crash reporter and auto updater. In most cases, you + * should just do everything in the ready event handler. + */ + on(event: 'will-finish-launching', listener: Function): this; + /** + * Emitted when all windows have been closed and the application will quit. Calling + * event.preventDefault() will prevent the default behaviour, which is terminating + * the application. See the description of the window-all-closed event for the + * differences between the will-quit and window-all-closed events. + */ + on(event: 'will-quit', listener: (event: Event) => void): this; + /** + * Emitted when all windows have been closed. If you do not subscribe to this event + * and all windows are closed, the default behavior is to quit the app; however, if + * you subscribe, you control whether the app quits or not. If the user pressed Cmd + * + Q, or the developer called app.quit(), Electron will first try to close all + * the windows and then emit the will-quit event, and in this case the + * window-all-closed event would not be emitted. + */ + on(event: 'window-all-closed', listener: Function): this; + /** + * Adds path to the recent documents list. This list is managed by the OS. On + * Windows you can visit the list from the task bar, and on macOS you can visit it + * from dock menu. + */ + addRecentDocument(path: string): void; + /** + * Append an argument to Chromium's command line. The argument will be quoted + * correctly. Note: This will not affect process.argv. + */ + appendArgument(value: string): void; + /** + * Append a switch (with optional value) to Chromium's command line. Note: This + * will not affect process.argv, and is mainly used by developers to control some + * low-level Chromium behaviors. + */ + appendSwitch(the_switch: string, value?: string): void; + /** + * When critical is passed, the dock icon will bounce until either the application + * becomes active or the request is canceled. When informational is passed, the + * dock icon will bounce for one second. However, the request remains active until + * either the application becomes active or the request is canceled. Returns an ID + * representing the request. + */ + bounce(type?: 'critical' | 'informational'): void; + /** + * Cancel the bounce of id. + */ + cancelBounce(id: number): void; + /** + * Clears the recent documents list. + */ + clearRecentDocuments(): void; + /** + * Disables hardware acceleration for current app. This method can only be called + * before app is ready. + */ + disableHardwareAcceleration(): void; + /** + * Bounces the Downloads stack if the filePath is inside the Downloads folder. + */ + downloadFinished(filePath: string): void; + /** + * Exits immediately with exitCode. exitCode defaults to 0. All windows will be + * closed immediately without asking user and the before-quit and will-quit events + * will not be emitted. + */ + exit(exitCode?: number): void; + /** + * On Linux, focuses on the first visible window. On macOS, makes the application + * the active app. On Windows, focuses on the application's first window. + */ + focus(): void; + getAppPath(): string; + getBadge(): string; + getBadgeCount(): number; + getCurrentActivityType(): string; + getJumpListSettings(): JumpListSettings; + /** + * Note: When distributing your packaged app, you have to also ship the locales + * folder. Note: On Windows you have to call it after the ready events gets + * emitted. + */ + getLocale(): string; + /** + * Note: This API has no effect on MAS builds. + */ + getLoginItemSettings(): LoginItemSettings; + /** + * Usually the name field of package.json is a short lowercased name, according to + * the npm modules spec. You should usually also specify a productName field, which + * is your application's full capitalized name, and which will be preferred over + * name by Electron. + */ + getName(): string; + /** + * You can request the following paths by the name: + */ + getPath(name: string): string; + getVersion(): string; + /** + * Hides all application windows without minimizing them. + */ + hide(): void; + /** + * Hides the dock icon. + */ + hide(): void; + /** + * Imports the certificate in pkcs12 format into the platform certificate store. + * callback is called with the result of import operation, a value of 0 indicates + * success while any other value indicates failure according to chromium + * net_error_list. + */ + importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void; + isAccessibilitySupportEnabled(): boolean; + /** + * This method checks if the current executable is the default handler for a + * protocol (aka URI scheme). If so, it will return true. Otherwise, it will return + * false. Note: On macOS, you can use this method to check if the app has been + * registered as the default protocol handler for a protocol. You can also verify + * this by checking ~/Library/Preferences/com.apple.LaunchServices.plist on the + * macOS machine. Please refer to Apple's documentation for details. The API uses + * the Windows Registry and LSCopyDefaultHandlerForURLScheme internally. + */ + isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; + isReady(): boolean; + isUnityRunning(): boolean; + isVisible(): boolean; + /** + * This method makes your application a Single Instance Application - instead of + * allowing multiple instances of your app to run, this will ensure that only a + * single instance of your app is running, and other instances signal this instance + * and exit. callback will be called with callback(argv, workingDirectory) when a + * second instance has been executed. argv is an Array of the second instance's + * command line arguments, and workingDirectory is its current working directory. + * Usually applications respond to this by making their primary window focused and + * non-minimized. The callback is guaranteed to be executed after the ready event + * of app gets emitted. This method returns false if your process is the primary + * instance of the application and your app should continue loading. And returns + * true if your process has sent its parameters to another instance, and you should + * immediately quit. On macOS the system enforces single instance automatically + * when users try to open a second instance of your app in Finder, and the + * open-file and open-url events will be emitted for that. However when users start + * your app in command line the system's single instance mechanism will be bypassed + * and you have to use this method to ensure single instance. An example of + * activating the window of primary instance when a second instance starts: + */ + makeSingleInstance(callback: (argv: string[], workingDirectory: string) => void): void; + /** + * Try to close all windows. The before-quit event will be emitted first. If all + * windows are successfully closed, the will-quit event will be emitted and by + * default the application will terminate. This method guarantees that all + * beforeunload and unload event handlers are correctly executed. It is possible + * that a window cancels the quitting by returning false in the beforeunload event + * handler. + */ + quit(): void; + /** + * Relaunches the app when current instance exits. By default the new instance will + * use the same working directory and command line arguments with current instance. + * When args is specified, the args will be passed as command line arguments + * instead. When execPath is specified, the execPath will be executed for relaunch + * instead of current app. Note that this method does not quit the app when + * executed, you have to call app.quit or app.exit after calling app.relaunch to + * make the app restart. When app.relaunch is called for multiple times, multiple + * instances will be started after current instance exited. An example of + * restarting current instance immediately and adding a new command line argument + * to the new instance: + */ + relaunch(options?: RelaunchOptions): void; + /** + * Releases all locks that were created by makeSingleInstance. This will allow + * multiple instances of the application to once again run side by side. + */ + releaseSingleInstance(): void; + /** + * This method checks if the current executable as the default handler for a + * protocol (aka URI scheme). If so, it will remove the app as the default handler. + */ + removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; + /** + * Set the about panel options. This will override the values defined in the app's + * .plist file. See the Apple docs for more details. + */ + setAboutPanelOptions(options: AboutPanelOptionsOptions): void; + /** + * Changes the Application User Model ID to id. + */ + setAppUserModelId(id: string): void; + /** + * This method sets the current executable as the default handler for a protocol + * (aka URI scheme). It allows you to integrate your app deeper into the operating + * system. Once registered, all links with your-protocol:// will be opened with the + * current executable. The whole link, including protocol, will be passed to your + * application as a parameter. On Windows you can provide optional parameters path, + * the path to your executable, and args, an array of arguments to be passed to + * your executable when it launches. Note: On macOS, you can only register + * protocols that have been added to your app's info.plist, which can not be + * modified at runtime. You can however change the file with a simple text editor + * or script during build time. Please refer to Apple's documentation for details. + * The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme + * internally. + */ + setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; + /** + * Sets the string to be displayed in the dock’s badging area. + */ + setBadge(text: string): void; + /** + * Sets the counter badge for current app. Setting the count to 0 will hide the + * badge. On macOS it shows on the dock icon. On Linux it only works for Unity + * launcher, Note: Unity launcher requires the exsistence of a .desktop file to + * work, for more information please read Desktop Environment Integration. + */ + setBadgeCount(count: number): boolean; + /** + * Sets the image associated with this dock icon. + */ + setIcon(image: NativeImage): void; + /** + * Sets or removes a custom Jump List for the application, and returns one of the + * following strings: If categories is null the previously set custom Jump List (if + * any) will be replaced by the standard Jump List for the app (managed by + * Windows). JumpListCategory objects should have the following properties: Note: + * If a JumpListCategory object has neither the type nor the name property set then + * its type is assumed to be tasks. If the name property is set but the type + * property is omitted then the type is assumed to be custom. Note: Users can + * remove items from custom categories, and Windows will not allow a removed item + * to be added back into a custom category until after the next successful call to + * app.setJumpList(categories). Any attempt to re-add a removed item to a custom + * category earlier than that will result in the entire custom category being + * omitted from the Jump List. The list of removed items can be obtained using + * app.getJumpListSettings(). JumpListItem objects should have the following + * properties: Here's a very simple example of creating a custom Jump List: + */ + setJumpList(categories: JumpListCategory[]): void; + /** + * Set the app's login item settings. Note: This API has no effect on MAS builds. + */ + setLoginItemSettings(settings: Settings): void; + /** + * Sets the application's dock menu. + */ + setMenu(menu: Menu): void; + /** + * Overrides the current application's name. + */ + setName(name: string): void; + /** + * Overrides the path to a special directory or file associated with name. If the + * path specifies a directory that does not exist, the directory will be created by + * this method. On failure an Error is thrown. You can only override paths of a + * name defined in app.getPath. By default, web pages' cookies and caches will be + * stored under the userData directory. If you want to change this location, you + * have to override the userData path before the ready event of the app module is + * emitted. + */ + setPath(name: string, path: string): void; + /** + * Creates an NSUserActivity and sets it as the current activity. The activity is + * eligible for Handoff to another device afterward. + */ + setUserActivity(type: string, userInfo: any, webpageURL: string): void; + /** + * Adds tasks to the Tasks category of the JumpList on Windows. tasks is an array + * of Task objects in the following format: Task Object: Note: If you'd like to + * customize the Jump List even more use app.setJumpList(categories) instead. + */ + setUserTasks(tasks: Task[]): boolean; + /** + * Shows the dock icon. + */ + show(): void; + /** + * Shows application windows after they were hidden. Does not automatically focus + * them. + */ + show(): void; + } + + interface AutoUpdater extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/auto-updater + + /** + * Emitted when checking if an update has started. + */ + on(event: 'checking-for-update', listener: Function): this; + /** + * Emitted when there is an error while updating. + */ + on(event: 'error', listener: (error: Error) => void): this; + /** + * Emitted when there is an available update. The update is downloaded + * automatically. + */ + on(event: 'update-available', listener: Function): this; + /** + * Emitted when an update has been downloaded. On Windows only releaseName is + * available. + */ + on(event: 'update-downloaded', listener: (event: Event, + releaseNotes: string, + releaseName: string, + releaseDate: Date, + updateURL: string) => void): this; + /** + * Emitted when there is no available update. + */ + on(event: 'update-not-available', listener: Function): this; + /** + * Asks the server whether there is an update. You must call setFeedURL before + * using this API. + */ + checkForUpdates(): void; + getFeedURL(): string; + /** + * Restarts the app and installs the update after it has been downloaded. It should + * only be called after update-downloaded has been emitted. + */ + quitAndInstall(): void; + /** + * Sets the url and initialize the auto updater. + */ + setFeedURL(url: string, requestHeaders: any): void; + } + + type BluetoothDevice = { + + // Docs: http://electron.atom.io/docs/api/structures/bluetooth-device + + deviceId: string; + deviceName: string; + } + + class BrowserWindow extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/browser-window + + /** + * Emitted when an App Command is invoked. These are typically related to keyboard + * media keys or browser commands, as well as the "Back" button built into some + * mice on Windows. Commands are lowercased, underscores are replaced with hyphens, + * and the APPCOMMAND_ prefix is stripped off. e.g. APPCOMMAND_BROWSER_BACKWARD is + * emitted as browser-backward. + */ + on(event: 'app-command', listener: (event: Event, + command: string) => void): this; + /** + * Emitted when the window loses focus. + */ + on(event: 'blur', listener: Function): this; + /** + * Emitted when the window is going to be closed. It's emitted before the + * beforeunload and unload event of the DOM. Calling event.preventDefault() will + * cancel the close. Usually you would want to use the beforeunload handler to + * decide whether the window should be closed, which will also be called when the + * window is reloaded. In Electron, returning any value other than undefined would + * cancel the close. For example: + */ + on(event: 'close', listener: (event: Event) => void): this; + /** + * Emitted when the window is closed. After you have received this event you should + * remove the reference to the window and avoid using it any more. + */ + on(event: 'closed', listener: Function): this; + /** + * Emitted when the window enters a full-screen state. + */ + on(event: 'enter-full-screen', listener: Function): this; + /** + * Emitted when the window enters a full-screen state triggered by HTML API. + */ + on(event: 'enter-html-full-screen', listener: Function): this; + /** + * Emitted when the window gains focus. + */ + on(event: 'focus', listener: Function): this; + /** + * Emitted when the window is hidden. + */ + on(event: 'hide', listener: Function): this; + /** + * Emitted when the window leaves a full-screen state. + */ + on(event: 'leave-full-screen', listener: Function): this; + /** + * Emitted when the window leaves a full-screen state triggered by HTML API. + */ + on(event: 'leave-html-full-screen', listener: Function): this; + /** + * Emitted when window is maximized. + */ + on(event: 'maximize', listener: Function): this; + /** + * Emitted when the window is minimized. + */ + on(event: 'minimize', listener: Function): this; + /** + * Emitted when the window is being moved to a new position. Note: On macOS this + * event is just an alias of moved. + */ + on(event: 'move', listener: Function): this; + /** + * Emitted once when the window is moved to a new position. + */ + on(event: 'moved', listener: Function): this; + /** + * Emitted when the document changed its title, calling event.preventDefault() will + * prevent the native window's title from changing. + */ + on(event: 'page-title-updated', listener: (event: Event, + title: string) => void): this; + /** + * Emitted when the web page has been rendered and window can be displayed without + * a visual flash. + */ + on(event: 'ready-to-show', listener: Function): this; + /** + * Emitted when the window is being resized. + */ + on(event: 'resize', listener: Function): this; + /** + * Emitted when the unresponsive web page becomes responsive again. + */ + on(event: 'responsive', listener: Function): this; + /** + * Emitted when the window is restored from a minimized state. + */ + on(event: 'restore', listener: Function): this; + /** + * Emitted when scroll wheel event phase has begun. + */ + on(event: 'scroll-touch-begin', listener: Function): this; + /** + * Emitted when scroll wheel event phase filed upon reaching the edge of element. + */ + on(event: 'scroll-touch-edge', listener: Function): this; + /** + * Emitted when scroll wheel event phase has ended. + */ + on(event: 'scroll-touch-end', listener: Function): this; + /** + * Emitted when the window is shown. + */ + on(event: 'show', listener: Function): this; + /** + * Emitted on 3-finger swipe. Possible directions are up, right, down, left. + */ + on(event: 'swipe', listener: (event: Event, + direction: string) => void): this; + /** + * Emitted when the window exits from a maximized state. + */ + on(event: 'unmaximize', listener: Function): this; + /** + * Emitted when the web page becomes unresponsive. + */ + on(event: 'unresponsive', listener: Function): this; + constructor(options: BrowserWindowConstructorOptions); + /** + * Adds DevTools extension located at path, and returns extension's name. The + * extension will be remembered so you only need to call this API once, this API is + * not for programming use. If you try to add an extension that has already been + * loaded, this method will not return and instead log a warning to the console. + * The method will also not return if the extension's manifest is missing or + * incomplete. Note: This API cannot be called before the ready event of the app + * module is emitted. + */ + static addDevToolsExtension(path: string): void; + static fromId(id: number): BrowserWindow; + static fromWebContents(webContents: WebContents): BrowserWindow; + static getAllWindows(): BrowserWindow[]; + /** + * To check if a DevTools extension is installed you can run the following: Note: + * This API cannot be called before the ready event of the app module is emitted. + */ + static getDevToolsExtensions(): DevToolsExtensions; + static getFocusedWindow(): BrowserWindow; + /** + * Remove a DevTools extension by name. Note: This API cannot be called before the + * ready event of the app module is emitted. + */ + static removeDevToolsExtension(name: string): void; + /** + * Removes focus from the window. + */ + blur(): void; + blurWebView(): void; + /** + * Same as webContents.capturePage([rect, ]callback). + */ + capturePage(callback: (image: NativeImage) => void): void; + /** + * Same as webContents.capturePage([rect, ]callback). + */ + capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; + /** + * Moves window to the center of the screen. + */ + center(): void; + /** + * Try to close the window. This has the same effect as a user manually clicking + * the close button of the window. The web page may cancel the close though. See + * the close event. + */ + close(): void; + /** + * Force closing the window, the unload and beforeunload event won't be emitted for + * the web page, and close event will also not be emitted for this window, but it + * guarantees the closed event will be emitted. + */ + destroy(): void; + /** + * Starts or stops flashing the window to attract user's attention. + */ + flashFrame(flag: boolean): void; + /** + * Focuses on the window. + */ + focus(): void; + focusOnWebView(): void; + getBounds(): Rectangle; + getChildWindows(): BrowserWindow[]; + getContentBounds(): Rectangle; + getContentSize(): number[]; + getMaximumSize(): number[]; + getMinimumSize(): number[]; + /** + * The native type of the handle is HWND on Windows, NSView* on macOS, and Window + * (unsigned long) on Linux. + */ + getNativeWindowHandle(): Buffer; + getParentWindow(): BrowserWindow; + getPosition(): number[]; + getRepresentedFilename(): string; + getSize(): number[]; + /** + * Note: The title of web page can be different from the title of the native + * window. + */ + getTitle(): string; + /** + * On Windows and Linux always returns true. + */ + hasShadow(): boolean; + /** + * Hides the window. + */ + hide(): void; + /** + * Hooks a windows message. The callback is called when the message is received in + * the WndProc. + */ + hookWindowMessage(message: number, callback: Function): void; + isAlwaysOnTop(): boolean; + /** + * On Linux always returns true. + */ + isClosable(): boolean; + isDestroyed(): boolean; + /** + * Whether Boolean - Whether the window's document has been edited. + */ + isDocumentEdited(): void; + isFocused(): boolean; + isFullScreen(): boolean; + isFullScreenable(): boolean; + isKiosk(): boolean; + /** + * On Linux always returns true. + */ + isMaximizable(): boolean; + isMaximized(): boolean; + isMenuBarAutoHide(): boolean; + isMenuBarVisible(): boolean; + /** + * On Linux always returns true. + */ + isMinimizable(): boolean; + isMinimized(): boolean; + isModal(): boolean; + /** + * On Linux always returns true. + */ + isMovable(): boolean; + isResizable(): boolean; + isVisible(): boolean; + /** + * Note: This API always returns false on Windows. + */ + isVisibleOnAllWorkspaces(): boolean; + isWindowMessageHooked(message: number): boolean; + /** + * Same as webContents.loadURL(url[, options]). The url can be a remote address + * (e.g. http://) or a path to a local HTML file using the file:// protocol. To + * ensure that file URLs are properly formatted, it is recommended to use Node's + * url.format method: + */ + loadURL(url: URL, options?: LoadURLOptions): void; + /** + * Maximizes the window. + */ + maximize(): void; + /** + * Minimizes the window. On some platforms the minimized window will be shown in + * the Dock. + */ + minimize(): void; + /** + * Uses Quick Look to preview a file at a given path. + */ + previewFile(path: string, displayName?: string): void; + /** + * Same as webContents.reload. + */ + reload(): void; + /** + * Restores the window from minimized state to its previous state. + */ + restore(): void; + /** + * Sets whether the window should show always on top of other windows. After + * setting this, the window is still a normal window, not a toolbox window which + * can not be focused on. + */ + setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver'): void; + /** + * This will make a window maintain an aspect ratio. The extra size allows a + * developer to have space, specified in pixels, not included within the aspect + * ratio calculations. This API already takes into account the difference between a + * window's size and its content size. Consider a normal window with an HD video + * player and associated controls. Perhaps there are 15 pixels of controls on the + * left edge, 25 pixels of controls on the right edge and 50 pixels of controls + * below the player. In order to maintain a 16:9 aspect ratio (standard aspect + * ratio for HD @1920x1080) within the player itself we would call this function + * with arguments of 16/9 and [ 40, 50 ]. The second argument doesn't care where + * the extra width and height are within the content view--only that they exist. + * Just sum any extra width and height areas you have within the overall content + * view. + */ + setAspectRatio(aspectRatio: number, extraSize?: ExtraSize): void; + /** + * Sets whether the window menu bar should hide itself automatically. Once set the + * menu bar will only show when users press the single Alt key. If the menu bar is + * already visible, calling setAutoHideMenuBar(true) won't hide it immediately. + */ + setAutoHideMenuBar(hide: boolean): void; + /** + * Resizes and moves the window to the supplied bounds + */ + setBounds(bounds: Rectangle, animate?: boolean): void; + /** + * Sets whether the window can be manually closed by user. On Linux does nothing. + */ + setClosable(closable: boolean): void; + /** + * Resizes and moves the window's client area (e.g. the web page) to the supplied + * bounds. + */ + setContentBounds(bounds: Rectangle, animate?: boolean): void; + /** + * Prevents the window contents from being captured by other apps. On macOS it sets + * the NSWindow's sharingType to NSWindowSharingNone. On Windows it calls + * SetWindowDisplayAffinity with WDA_MONITOR. + */ + setContentProtection(enable: boolean): void; + /** + * Resizes the window's client area (e.g. the web page) to width and height. + */ + setContentSize(width: number, height: number, animate?: boolean): void; + /** + * Specifies whether the window’s document has been edited, and the icon in title + * bar will become gray when set to true. + */ + setDocumentEdited(edited: boolean): void; + /** + * Changes whether the window can be focused. + */ + setFocusable(focusable: boolean): void; + /** + * Sets whether the window should be in fullscreen mode. + */ + setFullScreen(flag: boolean): void; + /** + * Sets whether the maximize/zoom window button toggles fullscreen mode or + * maximizes the window. + */ + setFullScreenable(fullscreenable: boolean): void; + /** + * Sets whether the window should have a shadow. On Windows and Linux does nothing. + */ + setHasShadow(hasShadow: boolean): void; + /** + * Changes window icon. + */ + setIcon(icon: NativeImage): void; + /** + * Makes the window ignore all mouse events. All mouse events happened in this + * window will be passed to the window below this window, but if this window has + * focus, it will still receive keyboard events. + */ + setIgnoreMouseEvents(ignore: boolean): void; + /** + * Enters or leaves the kiosk mode. + */ + setKiosk(flag: boolean): void; + /** + * Sets whether the window can be manually maximized by user. On Linux does + * nothing. + */ + setMaximizable(maximizable: boolean): void; + /** + * Sets the maximum size of window to width and height. + */ + setMaximumSize(width: number, height: number): void; + /** + * Sets the menu as the window's menu bar, setting it to null will remove the menu + * bar. + */ + setMenu(menu: Menu): void; + /** + * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users + * can still bring up the menu bar by pressing the single Alt key. + */ + setMenuBarVisibility(visible: boolean): void; + /** + * Sets whether the window can be manually minimized by user. On Linux does + * nothing. + */ + setMinimizable(minimizable: boolean): void; + /** + * Sets the minimum size of window to width and height. + */ + setMinimumSize(width: number, height: number): void; + /** + * Sets whether the window can be moved by user. On Linux does nothing. + */ + setMovable(movable: boolean): void; + /** + * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to + * convey some sort of application status or to passively notify the user. + */ + setOverlayIcon(overlay: NativeImage, description: string): void; + /** + * Sets parent as current window's parent window, passing null will turn current + * window into a top-level window. + */ + setParentWindow(parent: BrowserWindow): void; + /** + * Moves window to x and y. + */ + setPosition(x: number, y: number, animate?: boolean): void; + /** + * Sets progress value in progress bar. Valid range is [0, 1.0]. Remove progress + * bar when progress < 0; Change to indeterminate mode when progress > 1. On Linux + * platform, only supports Unity desktop environment, you need to specify the + * *.desktop file name to desktopName field in package.json. By default, it will + * assume app.getName().desktop. On Windows, a mode can be passed. Accepted values + * are none, normal, indeterminate, error, and paused. If you call setProgressBar + * without a mode set (but with a value within the valid range), normal will be + * assumed. + */ + setProgressBar(progress: number, options?: ProgressBarOptions): void; + /** + * Sets the pathname of the file the window represents, and the icon of the file + * will show in window's title bar. + */ + setRepresentedFilename(filename: string): void; + /** + * Sets whether the window can be manually resized by user. + */ + setResizable(resizable: boolean): void; + /** + * Changes the attachment point for sheets on macOS. By default, sheets are + * attached just below the window frame, but you may want to display them beneath a + * HTML-rendered toolbar. For example: + */ + setSheetOffset(offsetY: number, offsetX?: number): void; + /** + * Resizes the window to width and height. + */ + setSize(width: number, height: number, animate?: boolean): void; + /** + * Makes the window not show in the taskbar. + */ + setSkipTaskbar(skip: boolean): void; + /** + * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image + * of a window in a taskbar button layout. Returns a Boolean object indicates + * whether the thumbnail has been added successfully. The number of buttons in + * thumbnail toolbar should be no greater than 7 due to the limited room. Once you + * setup the thumbnail toolbar, the toolbar cannot be removed due to the platform's + * limitation. But you can call the API with an empty array to clean the buttons. + * The buttons is an array of Button objects: The flags is an array that can + * include following Strings: + */ + setThumbarButtons(buttons: ThumbarButton[]): boolean; + /** + * Sets the region of the window to show as the thumbnail image displayed when + * hovering over the window in the taskbar. You can reset the thumbnail to be the + * entire window by specifying an empty region: {x: 0, y: 0, width: 0, height: 0}. + */ + setThumbnailClip(region: Rectangle): void; + /** + * Sets the toolTip that is displayed when hovering over the window thumbnail in + * the taskbar. + */ + setThumbnailToolTip(toolTip: string): void; + /** + * Changes the title of native window to title. + */ + setTitle(title: string): void; + /** + * Sets whether the window should be visible on all workspaces. Note: This API does + * nothing on Windows. + */ + setVisibleOnAllWorkspaces(visible: boolean): void; + /** + * Shows and gives focus to the window. + */ + show(): void; + /** + * Same as webContents.showDefinitionForSelection(). + */ + showDefinitionForSelection(): void; + /** + * Shows the window but doesn't focus on it. + */ + showInactive(): void; + /** + * Unhooks all of the window messages. + */ + unhookAllWindowMessages(): void; + /** + * Unhook the window message. + */ + unhookWindowMessage(message: number): void; + /** + * Unmaximizes the window. + */ + unmaximize(): void; + id: number; + webContents: WebContents; + } + + class BrowserWindowProxy extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/browser-window-proxy + + /** + * Removes focus from the child window. + */ + blur(): void; + /** + * Forcefully closes the child window without calling its unload event. + */ + close(): void; + /** + * Evaluates the code in the child window. + */ + eval(code: string): void; + /** + * Focuses the child window (brings the window to front). + */ + focus(): void; + /** + * Sends a message to the child window with the specified origin or * for no origin + * preference. In addition to these methods, the child window implements + * window.opener object with no properties and a single method. + */ + postMessage(message: string, targetOrigin: string): void; + /** + * Invokes the print dialog on the child window. + */ + print(): void; + closed: boolean; + } + + type Certificate = { + + // Docs: http://electron.atom.io/docs/api/structures/certificate + + data: string; + fingerprint: string; + issuerName: string; + serialNumber: string; + subjectName: string; + validExpiry: number; + validStart: number; + } + + class ClientRequest extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/client-request + + /** + * Emitted when the request is aborted. The abort event will not be fired if the + * request is already closed. + */ + on(event: 'abort', listener: Function): this; + /** + * Emitted as the last event in the HTTP request-response transaction. The close + * event indicates that no more events will be emitted on either the request or + * response objects. + */ + on(event: 'close', listener: Function): this; + /** + * Emitted when the net module fails to issue a network request. Typically when the + * request object emits an error event, a close event will subsequently follow and + * no response object will be provided. + */ + on(event: 'error', listener: (/** + * an error object providing some information about the failure. + */ + error: Error) => void): this; + /** + * Emitted just after the last chunk of the request's data has been written into + * the request object. + */ + on(event: 'finish', listener: Function): this; + /** + * Emitted when an authenticating proxy is asking for user credentials. The + * callback function is expected to be called back with user credentials: Providing + * empty credentials will cancel the request and report an authentication error on + * the response object: + */ + on(event: 'login', listener: (authInfo: AuthInfo, + callback: Function) => void): this; + on(event: 'response', listener: (/** + * An object representing the HTTP response message. + */ + response: IncomingMessage) => void): this; + constructor(options: any | string); + /** + * Cancels an ongoing HTTP transaction. If the request has already emitted the + * close event, the abort operation will have no effect. Otherwise an ongoing event + * will emit abort and close events. Additionally, if there is an ongoing response + * object,it will emit the aborted event. + */ + abort(): void; + /** + * Sends the last chunk of the request data. Subsequent write or end operations + * will not be allowed. The finish event is emitted just after the end operation. + */ + end(chunk?: string | Buffer, encoding?: string, callback?: Function): void; + /** + * Returns String - The value of a previously set extra header name. + */ + getHeader(name: string): void; + /** + * Removes a previously set extra header name. This method can be called only + * before first write. Trying to call it after the first write will throw an error. + */ + removeHeader(name: string): void; + /** + * Adds an extra HTTP header. The header name will issued as it is without + * lowercasing. It can be called only before first write. Calling this method after + * the first write will throw an error. + */ + setHeader(name: string, value: string): void; + /** + * callback is essentially a dummy function introduced in the purpose of keeping + * similarity with the Node.js API. It is called asynchronously in the next tick + * after chunk content have been delivered to the Chromium networking layer. + * Contrary to the Node.js implementation, it is not guaranteed that chunk content + * have been flushed on the wire before callback is called. Adds a chunk of data to + * the request body. The first write operation may cause the request headers to be + * issued on the wire. After the first write operation, it is not allowed to add or + * remove a custom header. + */ + write(chunk: string | Buffer, encoding?: string, callback?: Function): void; + chunkedEncoding: boolean; + } + + interface Clipboard extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/clipboard + + availableFormats(type?: string): string[]; + /** + * Clears the clipboard content. + */ + clear(type?: string): void; + has(data: string, type?: string): boolean; + read(data: string, type?: string): string; + /** + * Returns an Object containing title and url keys representing the bookmark in the + * clipboard. The title and url values will be empty strings when the bookmark is + * unavailable. + */ + readBookmark(): ReadBookmark; + readFindText(): string; + readHTML(type?: string): string; + readImage(type?: string): NativeImage; + readRTF(type?: string): string; + readText(type?: string): string; + /** + * Writes data to the clipboard. + */ + write(data: Data, type?: string): void; + /** + * Writes the title and url into the clipboard as a bookmark. Note: Most apps on + * Windows don't support pasting bookmarks into them so you can use clipboard.write + * to write both a bookmark and fallback text to the clipboard. + */ + writeBookmark(title: string, url: string, type?: string): void; + /** + * Writes the text into the find pasteboard as plain text. This method uses + * synchronous IPC when called from the renderer process. + */ + writeFindText(text: string): void; + /** + * Writes markup to the clipboard. + */ + writeHTML(markup: string, type?: string): void; + /** + * Writes image to the clipboard. + */ + writeImage(image: NativeImage, type?: string): void; + /** + * Writes the text into the clipboard in RTF. + */ + writeRTF(text: string, type?: string): void; + /** + * Writes the text into the clipboard as plain text. + */ + writeText(text: string, type?: string): void; + } + + interface ContentTracing extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/content-tracing + + /** + * Cancel the watch event. This may lead to a race condition with the watch event + * callback if tracing is enabled. + */ + cancelWatchEvent(): void; + /** + * Get the current monitoring traced data. Child processes typically cache trace + * data and only rarely flush and send trace data back to the main process. This is + * because it may be an expensive operation to send the trace data over IPC and we + * would like to avoid unneeded runtime overhead from tracing. So, to end tracing, + * we must asynchronously ask all child processes to flush any pending trace data. + * Once all child processes have acknowledged the captureMonitoringSnapshot request + * the callback will be called with a file that contains the traced data. + */ + captureMonitoringSnapshot(resultFilePath: string, callback: (resultFilePath: string) => void): void; + /** + * Get a set of category groups. The category groups can change as new code paths + * are reached. Once all child processes have acknowledged the getCategories + * request the callback is invoked with an array of category groups. + */ + getCategories(callback: (categories: string[]) => void): void; + /** + * Get the maximum usage across processes of trace buffer as a percentage of the + * full state. When the TraceBufferUsage value is determined the callback is + * called. + */ + getTraceBufferUsage(callback: (value: number, percentage: number) => void): void; + /** + * callback will be called every time the given event occurs on any process. + */ + setWatchEvent(categoryName: string, eventName: string, callback: Function): void; + /** + * Start monitoring on all processes. Monitoring begins immediately locally and + * asynchronously on child processes as soon as they receive the startMonitoring + * request. Once all child processes have acknowledged the startMonitoring request + * the callback will be called. + */ + startMonitoring(options: StartMonitoringOptions, callback: Function): void; + /** + * Start recording on all processes. Recording begins immediately locally and + * asynchronously on child processes as soon as they receive the EnableRecording + * request. The callback will be called once all child processes have acknowledged + * the startRecording request. categoryFilter is a filter to control what category + * groups should be traced. A filter can have an optional - prefix to exclude + * category groups that contain a matching category. Having both included and + * excluded category patterns in the same list is not supported. Examples: + * traceOptions controls what kind of tracing is enabled, it is a comma-delimited + * list. Possible options are: The first 3 options are trace recoding modes and + * hence mutually exclusive. If more than one trace recording modes appear in the + * traceOptions string, the last one takes precedence. If none of the trace + * recording modes are specified, recording mode is record-until-full. The trace + * option will first be reset to the default option (record_mode set to + * record-until-full, enable_sampling and enable_systrace set to false) before + * options parsed from traceOptions are applied on it. + */ + startRecording(options: StartRecordingOptions, callback: Function): void; + /** + * Stop monitoring on all processes. Once all child processes have acknowledged the + * stopMonitoring request the callback is called. + */ + stopMonitoring(callback: Function): void; + /** + * Stop recording on all processes. Child processes typically cache trace data and + * only rarely flush and send trace data back to the main process. This helps to + * minimize the runtime overhead of tracing since sending trace data over IPC can + * be an expensive operation. So, to end tracing, we must asynchronously ask all + * child processes to flush any pending trace data. Once all child processes have + * acknowledged the stopRecording request, callback will be called with a file that + * contains the traced data. Trace data will be written into resultFilePath if it + * is not empty or into a temporary file. The actual file path will be passed to + * callback if it's not null. + */ + stopRecording(resultFilePath: string, callback: (resultFilePath: string) => void): void; + } + + type Cookie = { + + // Docs: http://electron.atom.io/docs/api/structures/cookie + + domain: string; + expirationDate?: number; + hostOnly: string; + httpOnly: boolean; + name: string; + path: string; + secure: boolean; + session: boolean; + value: string; + } + + class Cookies extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/cookies + + /** + * Emitted when a cookie is changed because it was added, edited, removed, or + * expired. + */ + on(event: 'changed', listener: (event: Event, + /** + * The cookie that was changed + */ + cookie: Cookie, + /** + * The cause of the change with one of the following values: + */ + cause: string, + /** + * `true` if the cookie was removed, `false` otherwise. + */ + removed: boolean) => void): this; + /** + * Sends a request to get all cookies matching details, callback will be called + * with callback(error, cookies) on complete. cookies is an Array of cookie + * objects. + */ + get(filter: Filter, callback: (error: Error, cookies: Cookies[]) => void): void; + /** + * Removes the cookies matching url and name, callback will called with callback() + * on complete. + */ + remove(url: string, name: string, callback: Function): void; + /** + * Sets a cookie with details, callback will be called with callback(error) on + * complete. + */ + set(details: Details, callback: (error: Error) => void): void; + } + + interface CrashReporter extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/crash-reporter + + /** + * Returns the date and ID of the last crash report. If no crash reports have been + * sent or the crash reporter has not been started, null is returned. + */ + getLastCrashReport(): LastCrashReport; + /** + * Returns all uploaded crash reports. Each report contains the date and uploaded + * ID. + */ + getUploadedReports(): Object[]; + /** + * You are required to call this method before using other crashReporter APIs. + * Note: On macOS, Electron uses a new crashpad client, which is different from + * breakpad on Windows and Linux. To enable the crash collection feature, you are + * required to call the crashReporter.start API to initialize crashpad in the main + * process and in each renderer process from which you wish to collect crash + * reports. + */ + start(options: CrashReporterStartOptions): void; + } + + class Debugger extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/debugger + + /** + * Emitted when debugging session is terminated. This happens either when + * webContents is closed or devtools is invoked for the attached webContents. + */ + on(event: 'detach', listener: (event: Event, + /** + * Reason for detaching debugger. + */ + reason: string) => void): this; + /** + * Emitted whenever debugging target issues instrumentation event. + */ + on(event: 'message', listener: (event: Event, + /** + * Method name. + */ + method: string, + /** + * Event parameters defined by the 'parameters' attribute in the remote debugging + * protocol. + */ + params: any) => void): this; + /** + * Attaches the debugger to the webContents. + */ + attach(protocolVersion?: string): void; + /** + * Detaches the debugger from the webContents. + */ + detach(): void; + isAttached(): boolean; + /** + * Send given command to the debugging target. + */ + sendCommand(method: string, commandParams?: any, callback?: (error: any, result: any) => void): void; + } + + interface DesktopCapturer extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/desktop-capturer + + /** + * Starts gathering information about all available desktop media sources, and + * calls callback(error, sources) when finished. sources is an array of + * DesktopCapturerSource objects, each DesktopCapturerSource represents a screen or + * an individual window that can be captured. + */ + getSources(options: SourcesOptions, callback: (error: Error, sources: DesktopCapturerSource[]) => void): void; + } + + type DesktopCapturerSource = { + + // Docs: http://electron.atom.io/docs/api/structures/desktop-capturer-source + + id: string; + name: string; + thumbnail: NativeImage; + } + + interface Dialog extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/dialog + + /** + * Displays a modal dialog that shows an error message. This API can be called + * safely before the ready event the app module emits, it is usually used to report + * errors in early stage of startup. If called before the app readyevent on Linux, + * the message will be emitted to stderr, and no GUI dialog will appear. + */ + showErrorBox(title: string, content: string): void; + /** + * Shows a message box, it will block the process until the message box is closed. + * It returns the index of the clicked button. If a callback is passed, the API + * call will be asynchronous and the result will be passed via callback(response). + */ + showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions, callback: (response: number) => void): void; + /** + * Shows a message box, it will block the process until the message box is closed. + * It returns the index of the clicked button. If a callback is passed, the API + * call will be asynchronous and the result will be passed via callback(response). + */ + showMessageBox(options: MessageBoxOptions, callback: (response: number) => void): void; + /** + * Shows a message box, it will block the process until the message box is closed. + * It returns the index of the clicked button. If a callback is passed, the API + * call will be asynchronous and the result will be passed via callback(response). + */ + showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions, callback: (response: number) => void): void; + /** + * On success this method returns an array of file paths chosen by the user, + * otherwise it returns undefined. The filters specifies an array of file types + * that can be displayed or selected when you want to limit the user to a specific + * type. For example: The extensions array should contain extensions without + * wildcards or dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show + * all files, use the '*' wildcard (no other wildcard is supported). If a callback + * is passed, the API call will be asynchronous and the result will be passed via + * callback(filenames) Note: On Windows and Linux an open dialog can not be both a + * file selector and a directory selector, so if you set properties to ['openFile', + * 'openDirectory'] on these platforms, a directory selector will be shown. + */ + showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions, callback?: (filePaths: string[]) => void): void; + /** + * On success this method returns an array of file paths chosen by the user, + * otherwise it returns undefined. The filters specifies an array of file types + * that can be displayed or selected when you want to limit the user to a specific + * type. For example: The extensions array should contain extensions without + * wildcards or dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show + * all files, use the '*' wildcard (no other wildcard is supported). If a callback + * is passed, the API call will be asynchronous and the result will be passed via + * callback(filenames) Note: On Windows and Linux an open dialog can not be both a + * file selector and a directory selector, so if you set properties to ['openFile', + * 'openDirectory'] on these platforms, a directory selector will be shown. + */ + showOpenDialog(options: OpenDialogOptions, callback?: (filePaths: string[]) => void): void; + /** + * On success this method returns the path of the file chosen by the user, + * otherwise it returns undefined. The filters specifies an array of file types + * that can be displayed, see dialog.showOpenDialog for an example. If a callback + * is passed, the API call will be asynchronous and the result will be passed via + * callback(filename) + */ + showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions, callback?: (filename: string) => void): void; + /** + * On success this method returns the path of the file chosen by the user, + * otherwise it returns undefined. The filters specifies an array of file types + * that can be displayed, see dialog.showOpenDialog for an example. If a callback + * is passed, the API call will be asynchronous and the result will be passed via + * callback(filename) + */ + showSaveDialog(options: SaveDialogOptions, callback?: (filename: string) => void): void; + } + + type Display = { + + // Docs: http://electron.atom.io/docs/api/structures/display + + bounds: Rectangle; + id: number; + rotation: number; + scaleFactor: number; + size: Size; + touchSupport: string; + workArea: Rectangle; + workAreaSize: WorkAreaSize; + } + + interface GlobalShortcut extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/global-shortcut + + /** + * When the accelerator is already taken by other applications, this call will + * still return false. This behavior is intended by operating systems, since they + * don't want applications to fight for global shortcuts. + */ + isRegistered(accelerator: Accelerator): boolean; + /** + * Registers a global shortcut of accelerator. The callback is called when the + * registered shortcut is pressed by the user. When the accelerator is already + * taken by other applications, this call will silently fail. This behavior is + * intended by operating systems, since they don't want applications to fight for + * global shortcuts. + */ + register(accelerator: Accelerator, callback: Function): void; + /** + * Unregisters the global shortcut of accelerator. + */ + unregister(accelerator: Accelerator): void; + /** + * Unregisters all of the global shortcuts. + */ + unregisterAll(): void; + } + + class IncomingMessage extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/incoming-message + + /** + * Emitted when a request has been canceled during an ongoing HTTP transaction. + */ + on(event: 'aborted', listener: Function): this; + /** + * The data event is the usual method of transferring response data into + * applicative code. + */ + on(event: 'data', listener: (/** + * A chunk of response body's data. + */ + chunk: Buffer) => void): this; + /** + * Indicates that response body has ended. + */ + on(event: 'end', listener: Function): this; + /** + * error Error - Typically holds an error string identifying failure root cause. + * Emitted when an error was encountered while streaming response data events. For + * instance, if the server closes the underlying while the response is still + * streaming, an error event will be emitted on the response object and a close + * event will subsequently follow on the request object. + */ + on(event: 'error', listener: Function): this; + headers: any; + httpVersion: string; + statusCode: number; + statusMessage: string; + } + + interface IpcMain extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/ipc-main + + } + + interface IpcRenderer extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/ipc-renderer + + } + + type JumpListCategory = { + + // Docs: http://electron.atom.io/docs/api/structures/jump-list-category + + items: JumpListItem[]; + name: string; + type: string; + } + + type JumpListItem = { + + // Docs: http://electron.atom.io/docs/api/structures/jump-list-item + + args: string; + description: string; + iconIndex: number; + iconPath: string; + path: string; + program: string; + title: string; + type: string; + } + + type MemoryUsageDetails = { + + // Docs: http://electron.atom.io/docs/api/structures/memory-usage-details + + count: number; + decodedSize: number; + liveSize: number; + purgeableSize: number; + purgedSize: number; + size: number; + } + + class Menu { + + // Docs: http://electron.atom.io/docs/api/menu + + constructor(); + /** + * Generally, the template is just an array of options for constructing a MenuItem. + * The usage can be referenced above. You can also attach other fields to the + * element of the template and they will become properties of the constructed menu + * items. + */ + static buildFromTemplate(template: MenuItem[]): void; + /** + * Returns the application menu (an instance of Menu), if set, or null, if not set. + */ + static getApplicationMenu(): void; + /** + * Sends the action to the first responder of application. This is used for + * emulating default Cocoa menu behaviors, usually you would just use the role + * property of MenuItem. See the macOS Cocoa Event Handling Guide for more + * information on macOS' native actions. + */ + static sendActionToFirstResponder(action: string): void; + /** + * Sets menu as the application menu on macOS. On Windows and Linux, the menu will + * be set as each window's top menu. Note: This API has to be called after the + * ready event of app module. + */ + static setApplicationMenu(menu: Menu): void; + /** + * Appends the menuItem to the menu. + */ + append(menuItem: MenuItem): void; + /** + * Inserts the menuItem to the pos position of the menu. + */ + insert(pos: number, menuItem: MenuItem): void; + /** + * Pops up this menu as a context menu in the browserWindow. + */ + popup(browserWindow?: BrowserWindow, x?: number, y?: number, positioningItem?: number): void; + items: MenuItem[]; + } + + class MenuItem { + + // Docs: http://electron.atom.io/docs/api/menu-item + + constructor(options: MenuItemConstructorOptions); + checked: boolean; + enabled: boolean; + visible: boolean; + } + + class NativeImage { + + // Docs: http://electron.atom.io/docs/api/native-image + + /** + * Creates an empty NativeImage instance. + */ + static createEmpty(): NativeImage; + /** + * Creates a new NativeImage instance from buffer. The default scaleFactor is 1.0. + */ + static createFromBuffer(buffer: Buffer, scaleFactor?: number): NativeImage; + /** + * Creates a new NativeImage instance from dataURL. + */ + static createFromDataURL(dataURL: string): void; + /** + * Creates a new NativeImage instance from a file located at path. This method + * returns an empty image if the path does not exist, cannot be read, or is not a + * valid image. + */ + static createFromPath(path: string): NativeImage; + crop(rect: Rect): NativeImage; + getAspectRatio(): number; + /** + * The difference between getBitmap() and toBitmap() is, getBitmap() does not copy + * the bitmap data, so you have to use the returned Buffer immediately in current + * event loop tick, otherwise the data might be changed or destroyed. + */ + getBitmap(): Buffer; + /** + * Notice that the returned pointer is a weak pointer to the underlying native + * image instead of a copy, so you must ensure that the associated nativeImage + * instance is kept around. + */ + getNativeHandle(): Buffer; + getSize(): Size; + isEmpty(): boolean; + isTemplateImage(): boolean; + /** + * If only the height or the width are specified then the current aspect ratio will + * be preserved in the resized image. + */ + resize(options: ResizeOptions): NativeImage; + /** + * Marks the image as a template image. + */ + setTemplateImage(option: boolean): void; + toBitmap(): Buffer; + toDataURL(): string; + toJPEG(quality: number): Buffer; + toPNG(): Buffer; + } + + interface Net extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/net + + /** + * Creates a ClientRequest instance using the provided options which are directly + * forwarded to the ClientRequest constructor. The net.request method would be used + * to issue both secure and insecure HTTP requests according to the specified + * protocol scheme in the options object. + */ + request(options: any | string): ClientRequest; + } + + interface PowerMonitor extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/power-monitor + + /** + * Emitted when the system changes to AC power. + */ + on(event: 'on-ac', listener: Function): this; + /** + * Emitted when system changes to battery power. + */ + on(event: 'on-battery', listener: Function): this; + /** + * Emitted when system is resuming. + */ + on(event: 'resume', listener: Function): this; + /** + * Emitted when the system is suspending. + */ + on(event: 'suspend', listener: Function): this; + } + + interface PowerSaveBlocker extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/power-save-blocker + + isStarted(id: number): boolean; + /** + * Starts preventing the system from entering lower-power mode. Returns an integer + * identifying the power save blocker. Note: prevent-display-sleep has higher + * precedence over prevent-app-suspension. Only the highest precedence type takes + * effect. In other words, prevent-display-sleep always takes precedence over + * prevent-app-suspension. For example, an API calling A requests for + * prevent-app-suspension, and another calling B requests for + * prevent-display-sleep. prevent-display-sleep will be used until B stops its + * request. After that, prevent-app-suspension is used. + */ + start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number; + /** + * Stops the specified power save blocker. + */ + stop(id: number): void; + } + + interface Process extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/process + + /** + * Emitted when Electron has loaded its internal initialization script and is + * beginning to load the web page or the main script. It can be used by the preload + * script to add removed Node global symbols back to the global scope when node + * integration is turned off: + */ + on(event: 'loaded', listener: Function): this; + /** + * Causes the main thread of the current process crash. + */ + crash(): void; + /** + * Returns an object giving memory usage statistics about the current process. Note + * that all statistics are reported in Kilobytes. + */ + getProcessMemoryInfo(): ProcessMemoryInfo; + /** + * Returns an object giving memory usage statistics about the entire system. Note + * that all statistics are reported in Kilobytes. + */ + getSystemMemoryInfo(): SystemMemoryInfo; + /** + * Causes the main thread of the current process hang. + */ + hang(): void; + /** + * Sets the file descriptor soft limit to maxDescriptors or the OS hard limit, + * whichever is lower for the current process. + */ + setFdLimit(maxDescriptors: number): void; + } + + interface Protocol extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/protocol + + /** + * Intercepts scheme protocol and uses handler as the protocol's new handler which + * sends a Buffer as a response. + */ + interceptBufferProtocol(scheme: string, handler: (request: InterceptBufferProtocolRequest, callback: (buffer?: Buffer) => void) => void, completion?: (error: Error) => void): void; + /** + * Intercepts scheme protocol and uses handler as the protocol's new handler which + * sends a file as a response. + */ + interceptFileProtocol(scheme: string, handler: (request: InterceptFileProtocolRequest, callback: (filePath: string) => void) => void, completion?: (error: Error) => void): void; + /** + * Intercepts scheme protocol and uses handler as the protocol's new handler which + * sends a new HTTP request as a response. + */ + interceptHttpProtocol(scheme: string, handler: (request: InterceptHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void; + /** + * Intercepts scheme protocol and uses handler as the protocol's new handler which + * sends a String as a response. + */ + interceptStringProtocol(scheme: string, handler: (request: InterceptStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void; + /** + * The callback will be called with a boolean that indicates whether there is + * already a handler for scheme. + */ + isProtocolHandled(scheme: string, callback: (error: Error) => void): void; + /** + * Registers a protocol of scheme that will send a Buffer as a response. The usage + * is the same with registerFileProtocol, except that the callback should be called + * with either a Buffer object or an object that has the data, mimeType, and + * charset properties. Example: + */ + registerBufferProtocol(scheme: string, handler: (request: RegisterBufferProtocolRequest, callback: (buffer?: Buffer) => void) => void, completion?: (error: Error) => void): void; + /** + * Registers a protocol of scheme that will send the file as a response. The + * handler will be called with handler(request, callback) when a request is going + * to be created with scheme. completion will be called with completion(null) when + * scheme is successfully registered or completion(error) when failed. To handle + * the request, the callback should be called with either the file's path or an + * object that has a path property, e.g. callback(filePath) or callback({path: + * filePath}). When callback is called with nothing, a number, or an object that + * has an error property, the request will fail with the error number you + * specified. For the available error numbers you can use, please see the net error + * list. By default the scheme is treated like http:, which is parsed differently + * than protocols that follow the "generic URI syntax" like file:, so you probably + * want to call protocol.registerStandardSchemes to have your scheme treated as a + * standard scheme. + */ + registerFileProtocol(scheme: string, handler: (request: RegisterFileProtocolRequest, callback: (filePath?: string) => void) => void, completion?: (error: Error) => void): void; + /** + * Registers a protocol of scheme that will send an HTTP request as a response. The + * usage is the same with registerFileProtocol, except that the callback should be + * called with a redirectRequest object that has the url, method, referrer, + * uploadData and session properties. By default the HTTP request will reuse the + * current session. If you want the request to have a different session you should + * set session to null. For POST requests the uploadData object must be provided. + */ + registerHttpProtocol(scheme: string, handler: (request: RegisterHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void; + registerServiceWorkerSchemes(schemes: string[]): void; + /** + * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example + * http and https are standard schemes, while file is not. Registering a scheme as + * standard, will allow relative and absolute resources to be resolved correctly + * when served. Otherwise the scheme will behave like the file protocol, but + * without the ability to resolve relative URLs. For example when you load + * following page with custom protocol without registering it as standard scheme, + * the image will not be loaded because non-standard schemes can not recognize + * relative URLs: Registering a scheme as standard will allow access to files + * through the FileSystem API. Otherwise the renderer will throw a security error + * for the scheme. By default web storage apis (localStorage, sessionStorage, + * webSQL, indexedDB, cookies) are disabled for non standard schemes. So in general + * if you want to register a custom protocol to replace the http protocol, you have + * to register it as a standard scheme: Note: This method can only be used before + * the ready event of the app module gets emitted. + */ + registerStandardSchemes(schemes: string[]): void; + /** + * Registers a protocol of scheme that will send a String as a response. The usage + * is the same with registerFileProtocol, except that the callback should be called + * with either a String or an object that has the data, mimeType, and charset + * properties. + */ + registerStringProtocol(scheme: string, handler: (request: RegisterStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void; + /** + * Remove the interceptor installed for scheme and restore its original handler. + */ + uninterceptProtocol(scheme: string, completion?: (error: Error) => void): void; + /** + * Unregisters the custom protocol of scheme. + */ + unregisterProtocol(scheme: string, completion?: (error: Error) => void): void; + } + + type Rectangle = { + + // Docs: http://electron.atom.io/docs/api/structures/rectangle + + height: number; + width: number; + x: number; + y: number; + } + + interface Remote extends MainInterface { + + // Docs: http://electron.atom.io/docs/api/remote + + getCurrentWebContents(): WebContents; + getCurrentWindow(): BrowserWindow; + getGlobal(name: string): any; + require(module: string): Require; + } + + interface Screen extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/screen + + /** + * Emitted when newDisplay has been added. + */ + on(event: 'display-added', listener: (event: Event, + newDisplay: Display) => void): this; + /** + * Emitted when one or more metrics change in a display. The changedMetrics is an + * array of strings that describe the changes. Possible changes are bounds, + * workArea, scaleFactor and rotation. + */ + on(event: 'display-metrics-changed', listener: (event: Event, + display: Display, + changedMetrics: string[]) => void): this; + /** + * Emitted when oldDisplay has been removed. + */ + on(event: 'display-removed', listener: (event: Event, + oldDisplay: Display) => void): this; + getAllDisplays(): Display[]; + /** + * The current absolute position of the mouse pointer. + */ + getCursorScreenPoint(): CursorScreenPoint; + getDisplayMatching(rect: Rectangle): Display; + getDisplayNearestPoint(point: Point): Display; + getPrimaryDisplay(): Display; + } + + class Session extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/session + + /** + * If partition starts with persist:, the page will use a persistent session + * available to all pages in the app with the same partition. if there is no + * persist: prefix, the page will use an in-memory session. If the partition is + * empty then default session of the app will be returned. To create a Session with + * options, you have to ensure the Session with the partition has never been used + * before. There is no way to change the options of an existing Session object. + */ + static fromPartition(partition: string, options: FromPartitionOptions): Session; + /** + * Emitted when Electron is about to download item in webContents. Calling + * event.preventDefault() will cancel the download and item will not be available + * from next tick of the process. + */ + on(event: 'will-download', listener: (event: Event, + item: DownloadItem, + webContents: WebContents) => void): this; + /** + * Clears the session’s HTTP cache. + */ + clearCache(callback: Function): void; + /** + * Clears the data of web storages. + */ + clearStorageData(options?: ClearStorageDataOptions, callback?: Function): void; + /** + * Writes any unwritten DOMStorage data to disk. + */ + flushStorageData(): void; + /** + * Returns the session's current cache size. + */ + getCacheSize(callback: (size: number) => void): void; + /** + * Sets the proxy settings. When pacScript and proxyRules are provided together, + * the proxyRules option is ignored and pacScript configuration is applied. The + * proxyRules has to follow the rules below: For example: The proxyBypassRules is a + * comma separated list of rules described below: + */ + setProxy(config: Config, callback: Function): void; + cookies: Cookies; + protocol: Protocol; + webRequest: WebRequest; + } + + interface Shell { + + // Docs: http://electron.atom.io/docs/api/shell + + /** + * Play the beep sound. + */ + beep(): void; + /** + * Move the given file to trash and returns a boolean status for the operation. + */ + moveItemToTrash(fullPath: string): boolean; + /** + * Open the given external protocol URL in the desktop's default manner. (For + * example, mailto: URLs in the user's default mail agent). + */ + openExternal(url: string, options?: OpenExternalOptions): boolean; + /** + * Open the given file in the desktop's default manner. + */ + openItem(fullPath: string): boolean; + /** + * Resolves the shortcut link at shortcutPath. An exception will be thrown when any + * error happens. + */ + readShortcutLink(shortcutPath: string): ShortcutDetails; + /** + * Show the given file in a file manager. If possible, select the file. + */ + showItemInFolder(fullPath: string): boolean; + /** + * Creates or updates a shortcut link at shortcutPath. + */ + writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean; + /** + * Creates or updates a shortcut link at shortcutPath. + */ + writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean; + } + + type ShortcutDetails = { + + // Docs: http://electron.atom.io/docs/api/structures/shortcut-details + + appUserModelId?: string; + args?: string; + cwd?: string; + description?: string; + icon?: string; + iconIndex?: number; + target: string; + } + + interface SystemPreferences extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/system-preferences + + on(event: 'accent-color-changed', listener: (event: Event, + /** + * The new RGBA color the user assigned to be there system accent color. + */ + newColor: string) => void): this; + on(event: 'color-changed', listener: (event: Event) => void): this; + on(event: 'inverted-color-scheme-changed', listener: (event: Event, + /** + * `true` if an inverted color scheme, such as a high contrast theme, is being + * used, `false` otherwise. + */ + invertedColorScheme: boolean) => void): this; + getAccentColor(): string; + getColor(color: '3d-dark-shadow' | '3d-face' | '3d-highlight' | '3d-light' | '3d-shadow' | 'active-border' | 'active-caption' | 'active-caption-gradient' | 'app-workspace' | 'button-text' | 'caption-text' | 'desktop' | 'disabled-text' | 'highlight' | 'highlight-text' | 'hotlight' | 'inactive-border' | 'inactive-caption' | 'inactive-caption-gradient' | 'inactive-caption-text' | 'info-background' | 'info-text' | 'menu' | 'menu-highlight' | 'menubar' | 'menu-text' | 'scrollbar' | 'window' | 'window-frame' | 'window-text'): string; + /** + * Get the value of key in system preferences. This API reads from NSUserDefaults + * on macOS, some popular key and types are: + */ + getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): void; + /** + * This method returns true if DWM composition (Aero Glass) is enabled, and false + * otherwise. An example of using it to determine if you should create a + * transparent window or not (transparent windows won't work correctly when DWM + * composition is disabled): + */ + isAeroGlassEnabled(): void; + isDarkMode(): boolean; + isInvertedColorScheme(): boolean; + isSwipeTrackingFromScrollEventsEnabled(): boolean; + /** + * Posts event as native notifications of macOS. The userInfo is an Object that + * contains the user information dictionary sent along with the notification. + */ + postLocalNotification(event: string, userInfo: any): void; + /** + * Posts event as native notifications of macOS. The userInfo is an Object that + * contains the user information dictionary sent along with the notification. + */ + postNotification(event: string, userInfo: any): void; + /** + * Same as subscribeNotification, but uses NSNotificationCenter for local defaults. + * This is necessary for events such as NSUserDefaultsDidChangeNotification + */ + subscribeLocalNotification(event: string, callback: (event: string, userInfo: any) => void): void; + /** + * Subscribes to native notifications of macOS, callback will be called with + * callback(event, userInfo) when the corresponding event happens. The userInfo is + * an Object that contains the user information dictionary sent along with the + * notification. The id of the subscriber is returned, which can be used to + * unsubscribe the event. Under the hood this API subscribes to + * NSDistributedNotificationCenter, example values of event are: + */ + subscribeNotification(event: string, callback: (event: string, userInfo: any) => void): void; + /** + * Same as unsubscribeNotification, but removes the subscriber from + * NSNotificationCenter. + */ + unsubscribeLocalNotification(id: number): void; + /** + * Removes the subscriber with id. + */ + unsubscribeNotification(id: number): void; + } + + type Task = { + + // Docs: http://electron.atom.io/docs/api/structures/task + + arguments: string; + description: string; + iconIndex: number; + iconPath: string; + program: string; + title: string; + } + + type ThumbarButton = { + + // Docs: http://electron.atom.io/docs/api/structures/thumbar-button + + click: Function; + flags?: string[]; + icon: NativeImage; + tooltip?: string; + } + + class Tray extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/tray + + /** + * Emitted when the tray balloon is clicked. + */ + on(event: 'balloon-click', listener: Function): this; + /** + * Emitted when the tray balloon is closed because of timeout or user manually + * closes it. + */ + on(event: 'balloon-closed', listener: Function): this; + /** + * Emitted when the tray balloon shows. + */ + on(event: 'balloon-show', listener: Function): this; + /** + * Emitted when the tray icon is clicked. + */ + on(event: 'click', listener: (event: Event, + /** + * The bounds of tray icon + */ + bounds: Rectangle) => void): this; + /** + * Emitted when the tray icon is double clicked. + */ + on(event: 'double-click', listener: (event: Event, + /** + * The bounds of tray icon + */ + bounds: Rectangle) => void): this; + /** + * Emitted when a drag operation ends on the tray or ends at another location. + */ + on(event: 'drag-end', listener: Function): this; + /** + * Emitted when a drag operation enters the tray icon. + */ + on(event: 'drag-enter', listener: Function): this; + /** + * Emitted when a drag operation exits the tray icon. + */ + on(event: 'drag-leave', listener: Function): this; + /** + * Emitted when any dragged items are dropped on the tray icon. + */ + on(event: 'drop', listener: Function): this; + /** + * Emitted when dragged files are dropped in the tray icon. + */ + on(event: 'drop-files', listener: (event: Event, + /** + * The paths of the dropped files. + */ + files: string[]) => void): this; + /** + * Emitted when dragged text is dropped in the tray icon. + */ + on(event: 'drop-text', listener: (event: Event, + /** + * the dropped text string + */ + text: string) => void): this; + /** + * Emitted when the tray icon is right clicked. + */ + on(event: 'right-click', listener: (event: Event, + /** + * The bounds of tray icon + */ + bounds: Rectangle) => void): this; + constructor(image: NativeImage); + /** + * Destroys the tray icon immediately. + */ + destroy(): void; + /** + * Displays a tray balloon. + */ + displayBalloon(options: DisplayBalloonOptions): void; + /** + * The bounds of this tray icon as Object. + */ + getBounds(): Rectangle; + isDestroyed(): boolean; + /** + * Pops up the context menu of the tray icon. When menu is passed, the menu will be + * shown instead of the tray icon's context menu. The position is only available on + * Windows, and it is (0, 0) by default. + */ + popUpContextMenu(menu?: Menu, position?: Position): void; + /** + * Sets the context menu for this icon. + */ + setContextMenu(menu: Menu): void; + /** + * Sets when the tray's icon background becomes highlighted (in blue). Note: You + * can use highlightMode with a BrowserWindow by toggling between 'never' and + * 'always' modes when the window visibility changes. + */ + setHighlightMode(mode: 'selection' | 'always' | 'never'): void; + /** + * Sets the image associated with this tray icon. + */ + setImage(image: NativeImage): void; + /** + * Sets the image associated with this tray icon when pressed on macOS. + */ + setPressedImage(image: NativeImage): void; + /** + * Sets the title displayed aside of the tray icon in the status bar. + */ + setTitle(title: string): void; + /** + * Sets the hover text for this tray icon. + */ + setToolTip(toolTip: string): void; + } + + type UploadData = { + + // Docs: http://electron.atom.io/docs/api/structures/upload-data + + blobUUID: string; + bytes: Buffer; + file: string; + } + + class WebContents extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/web-contents + + static fromId(id: number): WebContents; + static getAllWebContents(): WebContents[]; + static getFocusedWebContents(): WebContents; + /** + * Emitted when failed to verify the certificate for url. The usage is the same + * with the certificate-error event of app. + */ + on(event: 'certificate-error', listener: (event: Event, + url: URL, + /** + * The error code + */ + error: string, + certificate: Certificate, + callback: Function) => void): this; + /** + * Emitted when there is a new context menu that needs to be handled. + */ + on(event: 'context-menu', listener: (event: Event, + params: ContextMenuParams) => void): this; + /** + * Emitted when the renderer process crashes or is killed. + */ + on(event: 'crashed', listener: (event: Event, + killed: boolean) => void): this; + /** + * Emitted when the cursor's type changes. The type parameter can be default, + * crosshair, pointer, text, wait, help, e-resize, n-resize, ne-resize, nw-resize, + * s-resize, se-resize, sw-resize, w-resize, ns-resize, ew-resize, nesw-resize, + * nwse-resize, col-resize, row-resize, m-panning, e-panning, n-panning, + * ne-panning, nw-panning, s-panning, se-panning, sw-panning, w-panning, move, + * vertical-text, cell, context-menu, alias, progress, nodrop, copy, none, + * not-allowed, zoom-in, zoom-out, grab, grabbing, custom. If the type parameter is + * custom, the image parameter will hold the custom cursor image in a NativeImage, + * and scale, size and hotspot will hold additional information about the custom + * cursor. + */ + on(event: 'cursor-changed', listener: (event: Event, + type: string, + image?: NativeImage, + /** + * scaling factor for the custom cursor + */ + scale?: number, + /** + * the size of the `image` + */ + size?: Size, + /** + * coordinates of the custom cursor's hotspot + */ + hotspot?: Hotspot) => void): this; + /** + * Emitted when webContents is destroyed. + */ + on(event: 'destroyed', listener: Function): this; + /** + * Emitted when DevTools is closed. + */ + on(event: 'devtools-closed', listener: Function): this; + /** + * Emitted when DevTools is focused / opened. + */ + on(event: 'devtools-focused', listener: Function): this; + /** + * Emitted when DevTools is opened. + */ + on(event: 'devtools-opened', listener: Function): this; + /** + * Emitted when a page's theme color changes. This is usually due to encountering a + * meta tag: + */ + on(event: 'did-change-theme-color', listener: Function): this; + /** + * This event is like did-finish-load but emitted when the load failed or was + * cancelled, e.g. window.stop() is invoked. The full list of error codes and their + * meaning is available here. Note that redirect responses will emit errorCode -3; + * you may want to ignore that error explicitly. + */ + on(event: 'did-fail-load', listener: (event: Event, + errorCode: number, + errorDescription: string, + validatedURL: string, + isMainFrame: boolean) => void): this; + /** + * Emitted when the navigation is done, i.e. the spinner of the tab has stopped + * spinning, and the onload event was dispatched. + */ + on(event: 'did-finish-load', listener: Function): this; + /** + * Emitted when a frame has done navigation. + */ + on(event: 'did-frame-finish-load', listener: (event: Event, + isMainFrame: boolean) => void): this; + /** + * Emitted when a redirect is received while requesting a resource. + */ + on(event: 'did-get-redirect-request', listener: (event: Event, + oldURL: string, + newURL: string, + isMainFrame: boolean, + httpResponseCode: number, + requestMethod: string, + referrer: string, + headers: any) => void): this; + /** + * Emitted when details regarding a requested resource are available. status + * indicates the socket connection to download the resource. + */ + on(event: 'did-get-response-details', listener: (event: Event, + status: boolean, + newURL: string, + originalURL: string, + httpResponseCode: number, + requestMethod: string, + referrer: string, + headers: any, + resourceType: string) => void): this; + /** + * Emitted when a navigation is done. This event is not emitted for in-page + * navigations, such as clicking anchor links or updating the window.location.hash. + * Use did-navigate-in-page event for this purpose. + */ + on(event: 'did-navigate', listener: (event: Event, + url: string) => void): this; + /** + * Emitted when an in-page navigation happened. When in-page navigation happens, + * the page URL changes but does not cause navigation outside of the page. Examples + * of this occurring are when anchor links are clicked or when the DOM hashchange + * event is triggered. + */ + on(event: 'did-navigate-in-page', listener: (event: Event, + url: string, + isMainFrame: boolean) => void): this; + /** + * Corresponds to the points in time when the spinner of the tab started spinning. + */ + on(event: 'did-start-loading', listener: Function): this; + /** + * Corresponds to the points in time when the spinner of the tab stopped spinning. + */ + on(event: 'did-stop-loading', listener: Function): this; + /** + * Emitted when the document in the given frame is loaded. + */ + on(event: 'dom-ready', listener: (event: Event) => void): this; + /** + * Emitted when a result is available for webContents.findInPage request. + */ + on(event: 'found-in-page', listener: (event: Event, + result: Result) => void): this; + /** + * Emitted when webContents wants to do basic auth. The usage is the same with the + * login event of app. + */ + on(event: 'login', listener: (event: Event, + request: Request, + authInfo: AuthInfo, + callback: Function) => void): this; + /** + * Emitted when media is paused or done playing. + */ + on(event: 'media-paused', listener: Function): this; + /** + * Emitted when media starts playing. + */ + on(event: 'media-started-playing', listener: Function): this; + /** + * Emitted when the page requests to open a new window for a url. It could be + * requested by window.open or an external link like . By + * default a new BrowserWindow will be created for the url. Calling + * event.preventDefault() will prevent creating new windows. In such case, the + * event.newGuest may be set with a reference to a BrowserWindow instance to make + * it used by the Electron's runtime. + */ + on(event: 'new-window', listener: (event: Event, + url: string, + frameName: string, + /** + * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, + * `save-to-disk` and `other`. + */ + disposition: string, + /** + * The options which will be used for creating the new `BrowserWindow`. + */ + options: any, + /** + * The non-standard features (features not handled by Chromium or Electron) given + * to `window.open()`. + */ + additionalFeatures: string[]) => void): this; + /** + * Emitted when page receives favicon urls. + */ + on(event: 'page-favicon-updated', listener: (event: Event, + /** + * Array of URLs + */ + favicons: string[]) => void): this; + /** + * Emitted when a new frame is generated. Only the dirty area is passed in the + * buffer. + */ + on(event: 'paint', listener: (event: Event, + dirtyRect: Rectangle, + /** + * The image data of the whole frame. + */ + image: NativeImage) => void): this; + /** + * Emitted when a plugin process has crashed. + */ + on(event: 'plugin-crashed', listener: (event: Event, + name: string, + version: string) => void): this; + /** + * Emitted when bluetooth device needs to be selected on call to + * navigator.bluetooth.requestDevice. To use navigator.bluetooth api webBluetooth + * should be enabled. If event.preventDefault is not called, first available + * device will be selected. callback should be called with deviceId to be selected, + * passing empty string to callback will cancel the request. + */ + on(event: 'select-bluetooth-device', listener: (event: Event, + devices: BluetoothDevice[], + callback: Function) => void): this; + /** + * Emitted when a client certificate is requested. The usage is the same with the + * select-client-certificate event of app. + */ + on(event: 'select-client-certificate', listener: (event: Event, + url: URL, + certificateList: Certificate[], + callback: Function) => void): this; + /** + * Emitted when mouse moves over a link or the keyboard moves the focus to a link. + */ + on(event: 'update-target-url', listener: (event: Event, + url: string) => void): this; + /** + * Emitted when a user or the page wants to start navigation. It can happen when + * the window.location object is changed or a user clicks a link in the page. This + * event will not emit when the navigation is started programmatically with APIs + * like webContents.loadURL and webContents.back. It is also not emitted for + * in-page navigations, such as clicking anchor links or updating the + * window.location.hash. Use did-navigate-in-page event for this purpose. Calling + * event.preventDefault() will prevent the navigation. + */ + on(event: 'will-navigate', listener: (event: Event, + url: string) => void): this; + /** + * Adds the specified path to DevTools workspace. Must be used after DevTools + * creation: + */ + addWorkSpace(path: string): void; + /** + * Begin subscribing for presentation events and captured frames, the callback will + * be called with callback(frameBuffer, dirtyRect) when there is a presentation + * event. The frameBuffer is a Buffer that contains raw pixel data. On most + * machines, the pixel data is effectively stored in 32bit BGRA format, but the + * actual representation depends on the endianness of the processor (most modern + * processors are little-endian, on machines with big-endian processors the data is + * in 32bit ARGB format). The dirtyRect is an object with x, y, width, height + * properties that describes which part of the page was repainted. If onlyDirty is + * set to true, frameBuffer will only contain the repainted area. onlyDirty + * defaults to false. + */ + beginFrameSubscription(callback: (frameBuffer: Buffer, dirtyRect: Rectangle) => void): void; + /** + * Begin subscribing for presentation events and captured frames, the callback will + * be called with callback(frameBuffer, dirtyRect) when there is a presentation + * event. The frameBuffer is a Buffer that contains raw pixel data. On most + * machines, the pixel data is effectively stored in 32bit BGRA format, but the + * actual representation depends on the endianness of the processor (most modern + * processors are little-endian, on machines with big-endian processors the data is + * in 32bit ARGB format). The dirtyRect is an object with x, y, width, height + * properties that describes which part of the page was repainted. If onlyDirty is + * set to true, frameBuffer will only contain the repainted area. onlyDirty + * defaults to false. + */ + beginFrameSubscription(onlyDirty: boolean, callback: (frameBuffer: Buffer, dirtyRect: Rectangle) => void): void; + canGoBack(): boolean; + canGoForward(): boolean; + canGoToOffset(offset: number): boolean; + /** + * Captures a snapshot of the page within rect. Upon completion callback will be + * called with callback(image). The image is an instance of NativeImage that stores + * data of the snapshot. Omitting rect will capture the whole visible page. + */ + capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; + /** + * Captures a snapshot of the page within rect. Upon completion callback will be + * called with callback(image). The image is an instance of NativeImage that stores + * data of the snapshot. Omitting rect will capture the whole visible page. + */ + capturePage(callback: (image: NativeImage) => void): void; + /** + * Clears the navigation history. + */ + clearHistory(): void; + /** + * Closes the devtools. + */ + closeDevTools(): void; + /** + * Executes the editing command copy in web page. + */ + copy(): void; + /** + * Copy the image at the given position to the clipboard. + */ + copyImageAt(x: number, y: number): void; + /** + * Executes the editing command cut in web page. + */ + cut(): void; + /** + * Executes the editing command delete in web page. + */ + delete(): void; + /** + * Disable device emulation enabled by webContents.enableDeviceEmulation. + */ + disableDeviceEmulation(): void; + /** + * Initiates a download of the resource at url without navigating. The + * will-download event of session will be triggered. + */ + downloadURL(url: string): void; + /** + * Enable device emulation with the given parameters. + */ + enableDeviceEmulation(parameters: Parameters): void; + /** + * End subscribing for frame presentation events. + */ + endFrameSubscription(): void; + /** + * Evaluates code in page. In the browser window some HTML APIs like + * requestFullScreen can only be invoked by a gesture from the user. Setting + * userGesture to true will remove this limitation. + */ + executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): void; + /** + * Starts a request to find all matches for the text in the web page and returns an + * Integer representing the request id used for the request. The result of the + * request can be obtained by subscribing to found-in-page event. + */ + findInPage(text: string, options?: FindInPageOptions): void; + getFrameRate(): number; + getTitle(): string; + getURL(): string; + getUserAgent(): string; + /** + * Sends a request to get current zoom factor, the callback will be called with + * callback(zoomFactor). + */ + getZoomFactor(callback: (zoomFactor: number) => void): void; + /** + * Sends a request to get current zoom level, the callback will be called with + * callback(zoomLevel). + */ + getZoomLevel(callback: (zoomLevel: number) => void): void; + /** + * Makes the browser go back a web page. + */ + goBack(): void; + /** + * Makes the browser go forward a web page. + */ + goForward(): void; + /** + * Navigates browser to the specified absolute web page index. + */ + goToIndex(index: number): void; + /** + * Navigates to the specified offset from the "current entry". + */ + goToOffset(offset: number): void; + /** + * Checks if any ServiceWorker is registered and returns a boolean as response to + * callback. + */ + hasServiceWorker(callback: (hasWorker: boolean) => void): void; + /** + * Injects CSS into the current web page. + */ + insertCSS(css: string): void; + /** + * Inserts text to the focused element. + */ + insertText(text: string): void; + /** + * Starts inspecting element at position (x, y). + */ + inspectElement(x: number, y: number): void; + /** + * Opens the developer tools for the service worker context. + */ + inspectServiceWorker(): void; + /** + * If offscreen rendering is enabled invalidates the frame and generates a new one + * through the 'paint' event. + */ + invalidate(): void; + isAudioMuted(): boolean; + isCrashed(): boolean; + isDestroyed(): boolean; + isDevToolsFocused(): boolean; + isDevToolsOpened(): boolean; + isFocused(): boolean; + isLoading(): boolean; + isLoadingMainFrame(): boolean; + isOffscreen(): boolean; + isPainting(): boolean; + isWaitingForResponse(): boolean; + /** + * Loads the url in the window. The url must contain the protocol prefix, e.g. the + * http:// or file://. If the load should bypass http cache then use the pragma + * header to achieve it. + */ + loadURL(url: URL, options?: LoadURLOptions): void; + /** + * Opens the devtools. + */ + openDevTools(options?: OpenDevToolsOptions): void; + /** + * Executes the editing command paste in web page. + */ + paste(): void; + /** + * Executes the editing command pasteAndMatchStyle in web page. + */ + pasteAndMatchStyle(): void; + /** + * Prints window's web page. When silent is set to true, Electron will pick up + * system's default printer and default settings for printing. Calling + * window.print() in web page is equivalent to calling webContents.print({silent: + * false, printBackground: false}). Use page-break-before: always; CSS style to + * force to print to a new page. + */ + print(options?: PrintOptions): void; + /** + * Prints window's web page as PDF with Chromium's preview printing custom + * settings. The callback will be called with callback(error, data) on completion. + * The data is a Buffer that contains the generated PDF data. By default, an empty + * options will be regarded as: Use page-break-before: always; CSS style to force + * to print to a new page. An example of webContents.printToPDF: + */ + printToPDF(options: PrintToPDFOptions, callback: (error: Error, data: Buffer) => void): void; + /** + * Executes the editing command redo in web page. + */ + redo(): void; + /** + * Reloads the current web page. + */ + reload(): void; + /** + * Reloads current page and ignores cache. + */ + reloadIgnoringCache(): void; + /** + * Removes the specified path from DevTools workspace. + */ + removeWorkSpace(path: string): void; + /** + * Executes the editing command replace in web page. + */ + replace(text: string): void; + /** + * Executes the editing command replaceMisspelling in web page. + */ + replaceMisspelling(text: string): void; + /** + * Returns true if the process of saving page has been initiated successfully. + */ + savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML', callback: (error: Error) => void): void; + /** + * Executes the editing command selectAll in web page. + */ + selectAll(): void; + /** + * Send an asynchronous message to renderer process via channel, you can also send + * arbitrary arguments. Arguments will be serialized in JSON internally and hence + * no functions or prototype chain will be included. The renderer process can + * handle the message by listening to channel with the ipcRenderer module. An + * example of sending messages from the main process to the renderer process: + */ + send(channel: string): void; + /** + * Sends an input event to the page. For keyboard events, the event object also + * have following properties: For mouse events, the event object also have + * following properties: For the mouseWheel event, the event object also have + * following properties: + */ + sendInputEvent(event: Event): void; + /** + * Mute the audio on the current web page. + */ + setAudioMuted(muted: boolean): void; + /** + * If offscreen rendering is enabled sets the frame rate to the specified number. + * Only values between 1 and 60 are accepted. + */ + setFrameRate(fps: number): void; + /** + * Overrides the user agent for this web page. + */ + setUserAgent(userAgent: string): void; + /** + * Changes the zoom factor to the specified factor. Zoom factor is zoom percent + * divided by 100, so 300% = 3.0. + */ + setZoomFactor(factor: number): void; + /** + * Changes the zoom level to the specified level. The original size is 0 and each + * increment above or below represents zooming 20% larger or smaller to default + * limits of 300% and 50% of original size, respectively. + */ + setZoomLevel(level: number): void; + /** + * Sets the maximum and minimum zoom level. + */ + setZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; + /** + * Shows pop-up dictionary that searches the selected word on the page. + */ + showDefinitionForSelection(): void; + /** + * Sets the item as dragging item for current drag-drop operation, file is the + * absolute path of the file to be dragged, and icon is the image showing under the + * cursor when dragging. + */ + startDrag(item: Item): void; + /** + * If offscreen rendering is enabled and not painting, start painting. + */ + startPainting(): void; + /** + * Stops any pending navigation. + */ + stop(): void; + /** + * Stops any findInPage request for the webContents with the provided action. + */ + stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void; + /** + * If offscreen rendering is enabled and painting, stop painting. + */ + stopPainting(): void; + /** + * Toggles the developer tools. + */ + toggleDevTools(): void; + /** + * Executes the editing command undo in web page. + */ + undo(): void; + /** + * Unregisters any ServiceWorker if present and returns a boolean as response to + * callback when the JS promise is fulfilled or false when the JS promise is + * rejected. + */ + unregisterServiceWorker(callback: (success: boolean) => void): void; + /** + * Executes the editing command unselect in web page. + */ + unselect(): void; + debugger: Debugger; + devToolsWebContents: WebContents; + hostWebContents: WebContents; + id: number; + session: Session; + } + + interface WebFrame extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/web-frame + + /** + * Attempts to free memory that is no longer being used (like images from a + * previous navigation). Note that blindly calling this method probably makes + * Electron slower since it will have to refill these emptied caches, you should + * only call it if an event in your app has occurred that makes you think your page + * is actually using less memory (i.e. you have navigated from a super heavy page + * to a mostly empty one, and intend to stay there). + */ + clearCache(): void; + /** + * Evaluates code in page. In the browser window some HTML APIs like + * requestFullScreen can only be invoked by a gesture from the user. Setting + * userGesture to true will remove this limitation. + */ + executeJavaScript(code: string, userGesture?: boolean): void; + /** + * Returns an object describing usage information of Blink's internal memory + * caches. This will generate: + */ + getResourceUsage(): ResourceUsage; + getZoomFactor(): number; + getZoomLevel(): number; + /** + * Inserts text to the focused element. + */ + insertText(text: string): void; + /** + * Resources will be loaded from this scheme regardless of the current page's + * Content Security Policy. + */ + registerURLSchemeAsBypassingCSP(scheme: string): void; + /** + * Registers the scheme as secure, bypasses content security policy for resources, + * allows registering ServiceWorker and supports fetch API. Specify an option with + * the value of false to omit it from the registration. An example of registering a + * privileged scheme, without bypassing Content Security Policy: + */ + registerURLSchemeAsPrivileged(scheme: string, options?: RegisterURLSchemeAsPrivilegedOptions): void; + /** + * Registers the scheme as secure scheme. Secure schemes do not trigger mixed + * content warnings. For example, https and data are secure schemes because they + * cannot be corrupted by active network attackers. + */ + registerURLSchemeAsSecure(scheme: string): void; + /** + * Sets a provider for spell checking in input fields and text areas. The provider + * must be an object that has a spellCheck method that returns whether the word + * passed is correctly spelled. An example of using node-spellchecker as provider: + */ + setSpellCheckProvider(language: string, autoCorrectWord: boolean, provider: any): void; + /** + * Changes the zoom factor to the specified factor. Zoom factor is zoom percent + * divided by 100, so 300% = 3.0. + */ + setZoomFactor(factor: number): void; + /** + * Changes the zoom level to the specified level. The original size is 0 and each + * increment above or below represents zooming 20% larger or smaller to default + * limits of 300% and 50% of original size, respectively. + */ + setZoomLevel(level: number): void; + /** + * Sets the maximum and minimum zoom level. + */ + setZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; + } + + class WebRequest extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/web-request + + /** + * The listener will be called with listener(details) when a server initiated + * redirect is about to occur. + */ + onBeforeRedirect(filter: any, listener: (details: OnBeforeRedirectDetails) => void): void; + /** + * The listener will be called with listener(details, callback) when a request is + * about to occur. The uploadData is an array of UploadData objects. The callback + * has to be called with an response object. + */ + onBeforeRequest(filter: any, listener: (details: OnBeforeRequestDetails, callback: (response: Response) => void) => void): void; + /** + * The listener will be called with listener(details, callback) before sending an + * HTTP request, once the request headers are available. This may occur after a TCP + * connection is made to the server, but before any http data is sent. The callback + * has to be called with an response object. + */ + onBeforeSendHeaders(filter: any, listener: Function): void; + /** + * The listener will be called with listener(details) when a request is completed. + */ + onCompleted(filter: any, listener: (details: OnCompletedDetails) => void): void; + /** + * The listener will be called with listener(details) when an error occurs. + */ + onErrorOccurred(filter: any, listener: (details: OnErrorOccurredDetails) => void): void; + /** + * The listener will be called with listener(details, callback) when HTTP response + * headers of a request have been received. The callback has to be called with an + * response object. + */ + onHeadersReceived(filter: any, listener: Function): void; + /** + * The listener will be called with listener(details) when first byte of the + * response body is received. For HTTP requests, this means that the status line + * and response headers are available. + */ + onResponseStarted(filter: any, listener: (details: OnResponseStartedDetails) => void): void; + /** + * The listener will be called with listener(details) just before a request is + * going to be sent to the server, modifications of previous onBeforeSendHeaders + * response are visible by the time this listener is fired. + */ + onSendHeaders(filter: any, listener: (details: OnSendHeadersDetails) => void): void; + } + + interface AboutPanelOptionsOptions { + /** + * The app's name. + */ + applicationName?: string; + /** + * The app's version. + */ + applicationVersion?: string; + /** + * Copyright information. + */ + copyright?: string; + /** + * Credit information. + */ + credits?: string; + /** + * The app's build version number. + */ + version?: string; + } + + interface AuthInfo { + isProxy: boolean; + scheme: string; + host: string; + port: number; + realm: string; + } + + interface BrowserWindowConstructorOptions { + /** + * Window's width in pixels. Default is . + */ + width: number; + /** + * Window's height in pixels. Default is . + */ + height: number; + /** + * ( if y is used) - Window's left offset from screen. Default is to center the + * window. + */ + x?: number; + /** + * ( if x is used) - Window's top offset from screen. Default is to center the + * window. + */ + y?: number; + /** + * The and would be used as web page's size, which means the actual window's size + * will include window frame's size and be slightly larger. Default is . + */ + useContentSize: boolean; + /** + * Show window in the center of the screen. + */ + center: boolean; + /** + * Window's minimum width. Default is . + */ + minWidth: number; + /** + * Window's minimum height. Default is . + */ + minHeight: number; + /** + * Window's maximum width. Default is no limit. + */ + maxWidth: number; + /** + * Window's maximum height. Default is no limit. + */ + maxHeight: number; + /** + * Whether window is resizable. Default is . + */ + resizable: boolean; + /** + * Whether window is movable. This is not implemented on Linux. Default is . + */ + movable: boolean; + /** + * Whether window is minimizable. This is not implemented on Linux. Default is . + */ + minimizable: boolean; + /** + * Whether window is maximizable. This is not implemented on Linux. Default is . + */ + maximizable: boolean; + /** + * Whether window is closable. This is not implemented on Linux. Default is . + */ + closable: boolean; + /** + * Whether the window can be focused. Default is . On Windows setting also implies + * setting . On Linux setting makes the window stop interacting with wm, so the + * window will always stay on top in all workspaces. + */ + focusable: boolean; + /** + * Whether the window should always stay on top of other windows. Default is . + */ + alwaysOnTop: boolean; + /** + * Whether the window should show in fullscreen. When explicitly set to the + * fullscreen button will be hidden or disabled on macOS. Default is . + */ + fullscreen: boolean; + /** + * Whether the window can be put into fullscreen mode. On macOS, also whether the + * maximize/zoom button should toggle full screen mode or maximize window. Default + * is . + */ + fullscreenable: boolean; + /** + * Whether to show the window in taskbar. Default is . + */ + skipTaskbar: boolean; + /** + * The kiosk mode. Default is . + */ + kiosk: boolean; + /** + * Default window title. Default is . + */ + title: string; + /** + * The window icon. On Windows it is recommended to use icons to get best visual + * effects, you can also leave it undefined so the executable's icon will be used. + */ + icon: NativeImage; + /** + * Whether window should be shown when created. Default is . + */ + show: boolean; + /** + * Specify to create a . Default is . + */ + frame: boolean; + /** + * Specify parent window. Default is . + */ + parent: BrowserWindow; + /** + * Whether this is a modal window. This only works when the window is a child + * window. Default is . + */ + modal: boolean; + /** + * Whether the web view accepts a single mouse-down event that simultaneously + * activates the window. Default is . + */ + acceptFirstMouse: boolean; + /** + * Whether to hide cursor when typing. Default is . + */ + disableAutoHideCursor: boolean; + /** + * Auto hide the menu bar unless the key is pressed. Default is . + */ + autoHideMenuBar: boolean; + /** + * Enable the window to be resized larger than screen. Default is . + */ + enableLargerThanScreen: boolean; + /** + * Window's background color as Hexadecimal value, like or or (alpha is supported). + * Default is (white). + */ + backgroundColor: string; + /** + * Whether window should have a shadow. This is only implemented on macOS. Default + * is . + */ + hasShadow: boolean; + /** + * Forces using dark theme for the window, only works on some GTK+3 desktop + * environments. Default is . + */ + darkTheme: boolean; + /** + * Makes the window . Default is . + */ + transparent: boolean; + /** + * The type of window, default is normal window. See more about this below. + */ + type: string; + /** + * The style of window title bar. Default is . Possible values are: + */ + titleBarStyle: string; + /** + * Use style for frameless windows on Windows, which adds standard window frame. + * Setting it to will remove window shadow and window animations. Default is . + */ + thickFrame: boolean; + /** + * Settings of web page's features. + */ + webPreferences: WebPreferences; + } + + interface ClearStorageDataOptions { + /** + * Should follow ’s representation . + */ + origin: string; + /** + * The types of storages to clear, can contain: , , , , , , , + */ + storages: string[]; + /** + * The types of quotas to clear, can contain: , , . + */ + quotas: string[]; + } + + interface Config { + /** + * The URL associated with the PAC file. + */ + pacScript: string; + /** + * Rules indicating which proxies to use. + */ + proxyRules: string; + /** + * Rules indicating which URLs should bypass the proxy settings. + */ + proxyBypassRules: string; + } + + interface ContextMenuParams { + /** + * x coordinate + */ + x: number; + /** + * y coordinate + */ + y: number; + /** + * URL of the link that encloses the node the context menu was invoked on. + */ + linkURL: string; + /** + * Text associated with the link. May be an empty string if the contents of the + * link are an image. + */ + linkText: string; + /** + * URL of the top level page that the context menu was invoked on. + */ + pageURL: string; + /** + * URL of the subframe that the context menu was invoked on. + */ + frameURL: string; + /** + * Source URL for the element that the context menu was invoked on. Elements with + * source URLs are images, audio and video. + */ + srcURL: string; + /** + * Type of the node the context menu was invoked on. Can be , , , , , or . + */ + mediaType: string; + /** + * Whether the context menu was invoked on an image which has non-empty contents. + */ + hasImageContents: boolean; + /** + * Whether the context is editable. + */ + isEditable: boolean; + /** + * Text of the selection that the context menu was invoked on. + */ + selectionText: string; + /** + * Title or alt text of the selection that the context was invoked on. + */ + titleText: string; + /** + * The misspelled word under the cursor, if any. + */ + misspelledWord: string; + /** + * The character encoding of the frame on which the menu was invoked. + */ + frameCharset: string; + /** + * If the context menu was invoked on an input field, the type of that field. + * Possible values are , , , . + */ + inputFieldType: string; + /** + * Input source that invoked the context menu. Can be , , , , . + */ + menuSourceType: string; + /** + * The flags for the media element the context menu was invoked on. + */ + mediaFlags: MediaFlags; + /** + * These flags indicate whether the renderer believes it is able to perform the + * corresponding action. + */ + editFlags: EditFlags; + } + + interface CrashReporterStartOptions { + companyName: string; + /** + * URL that crash reports will be sent to as POST. + */ + submitURL: string; + /** + * Defaults to . + */ + productName?: string; + /** + * Send the crash report without user interaction. Default is . + */ + autoSubmit: boolean; + /** + * Default is . + */ + ignoreSystemCrashHandler: boolean; + /** + * An object you can define that will be sent along with the report. Only string + * properties are sent correctly, Nested objects are not supported. + */ + extra: Extra; + } + + interface CursorScreenPoint { + x: number; + y: number; + } + + interface Data { + text: string; + html: string; + image: NativeImage; + rtf: string; + /** + * The title of the url at . + */ + bookmark: string; + } + + interface Details { + /** + * The url to associate the cookie with. + */ + url: string; + /** + * The name of the cookie. Empty by default if omitted. + */ + name: string; + /** + * The value of the cookie. Empty by default if omitted. + */ + value: string; + /** + * The domain of the cookie. Empty by default if omitted. + */ + domain: string; + /** + * The path of the cookie. Empty by default if omitted. + */ + path: string; + /** + * Whether the cookie should be marked as Secure. Defaults to false. + */ + secure: boolean; + /** + * Whether the cookie should be marked as HTTP only. Defaults to false. + */ + httpOnly: boolean; + /** + * - The expiration date of the cookie as the number of seconds since the UNIX + * epoch. If omitted then the cookie becomes a session cookie and will not be + * retained between sessions. + */ + expirationDate: number; + } + + interface DevToolsExtensions { + } + + interface DisplayBalloonOptions { + icon: NativeImage; + title: string; + content: string; + } + + interface ExtraSize { + width: number; + height: number; + } + + interface Filter { + /** + * Retrieves cookies which are associated with . Empty implies retrieving cookies + * of all urls. + */ + url?: string; + /** + * Filters cookies by name. + */ + name?: string; + /** + * Retrieves cookies whose domains match or are subdomains of + */ + domain?: string; + /** + * Retrieves cookies whose path matches . + */ + path?: string; + /** + * Filters cookies by their Secure property. + */ + secure?: boolean; + /** + * Filters out session or persistent cookies. + */ + session?: boolean; + } + + interface FindInPageOptions { + /** + * Whether to search forward or backward, defaults to . + */ + forward: boolean; + /** + * Whether the operation is first request or a follow up, defaults to . + */ + findNext: boolean; + /** + * Whether search should be case-sensitive, defaults to . + */ + matchCase: boolean; + /** + * Whether to look only at the start of words. defaults to . + */ + wordStart: boolean; + /** + * When combined with , accepts a match in the middle of a word if the match begins + * with an uppercase letter followed by a lowercase or non-letter. Accepts several + * other intra-word matches, defaults to . + */ + medialCapitalAsWordStart: boolean; + } + + interface FromPartitionOptions { + /** + * Whether to enable cache. + */ + cache: boolean; + } + + interface Hotspot { + /** + * x coordinate + */ + x: number; + /** + * y coordinate + */ + y: number; + } + + interface ImportCertificateOptions { + /** + * Path for the pkcs12 file. + */ + certificate: string; + /** + * Passphrase for the certificate. + */ + password: string; + } + + interface InterceptBufferProtocolRequest { + url: string; + referrer: string; + method: string; + uploadData: UploadData[]; + } + + interface InterceptFileProtocolRequest { + url: string; + referrer: string; + method: string; + uploadData: UploadData[]; + } + + interface InterceptHttpProtocolRequest { + url: string; + referrer: string; + method: string; + uploadData: UploadData[]; + } + + interface InterceptStringProtocolRequest { + url: string; + referrer: string; + method: string; + uploadData: UploadData[]; + } + + interface Item { + file: string; + icon: NativeImage; + } + + interface JumpListSettings { + /** + * The minimum number of items that will be shown in the Jump List (for a more + * detailed description of this value see the ). + */ + minItems: number; + /** + * Array of objects that correspond to items that the user has explicitly removed + * from custom categories in the Jump List. These items must not be re-added to the + * Jump List in the call to , Windows will not display any custom category that + * contains any of the removed items. + */ + removedItems: JumpListItem[]; + } + + interface LastCrashReport { + date: string; + ID: number; + } + + interface LoadURLOptions { + /** + * A HTTP Referrer url. + */ + httpReferrer: string; + /** + * A user agent originating the request. + */ + userAgent: string; + /** + * Extra headers separated by "\n" + */ + extraHeaders: string; + } + + interface LoginItemSettings { + /** + * if the app is set to open at login. + */ + openAtLogin: boolean; + /** + * if the app is set to open as hidden at login. This setting is only supported on + * macOS. + */ + openAsHidden: boolean; + /** + * if the app was opened at login automatically. This setting is only supported on + * macOS. + */ + wasOpenedAtLogin: boolean; + /** + * if the app was opened as a hidden login item. This indicates that the app should + * not open any windows at startup. This setting is only supported on macOS. + */ + wasOpenedAsHidden: boolean; + /** + * if the app was opened as a login item that should restore the state from the + * previous session. This indicates that the app should restore the windows that + * were open the last time the app was closed. This setting is only supported on + * macOS. + */ + restoreState: boolean; + } + + interface MenuItemConstructorOptions { + /** + * Will be called with when the menu item is clicked. + */ + click: (menuItem: MenuItem, browserWindow: BrowserWindow, event: Event) => void; + /** + * Define the action of the menu item, when specified the property will be ignored. + */ + role: string; + /** + * Can be , , , or . + */ + type: string; + label: string; + sublabel: string; + accelerator: Accelerator; + icon: NativeImage; + /** + * If false, the menu item will be greyed out and unclickable. + */ + enabled: boolean; + /** + * If false, the menu item will be entirely hidden. + */ + visible: boolean; + /** + * Should only be specified for or type menu items. + */ + checked: boolean; + /** + * Should be specified for type menu items. If is specified, the can be omitted. If + * the value is not a then it will be automatically converted to one using . + */ + submenu: Menu; + /** + * Unique within a single menu. If defined then it can be used as a reference to + * this item by the position attribute. + */ + id: string; + /** + * This field allows fine-grained definition of the specific location within a + * given menu. + */ + position: string; + } + + interface MessageBoxOptions { + /** + * Can be , , , or . On Windows, "question" displays the same icon as "info", + * unless you set an icon using the "icon" option. + */ + type: string; + /** + * Array of texts for buttons. On Windows, an empty array will result in one button + * labeled "OK". + */ + buttons: string[]; + /** + * Index of the button in the buttons array which will be selected by default when + * the message box opens. + */ + defaultId: number; + /** + * Title of the message box, some platforms will not show it. + */ + title: string; + /** + * Content of the message box. + */ + message: string; + /** + * Extra information of the message. + */ + detail: string; + icon: NativeImage; + /** + * The value will be returned when user cancels the dialog instead of clicking the + * buttons of the dialog. By default it is the index of the buttons that have + * "cancel" or "no" as label, or 0 if there is no such buttons. On macOS and + * Windows the index of "Cancel" button will always be used as , not matter whether + * it is already specified. + */ + cancelId: number; + /** + * On Windows Electron will try to figure out which one of the are common buttons + * (like "Cancel" or "Yes"), and show the others as command links in the dialog. + * This can make the dialog appear in the style of modern Windows apps. If you + * don't like this behavior, you can set to . + */ + noLink: boolean; + } + + interface OnBeforeRedirectDetails { + id: string; + url: string; + method: string; + resourceType: string; + timestamp: number; + redirectURL: string; + statusCode: number; + /** + * The server IP address that the request was actually sent to. + */ + ip?: string; + fromCache: boolean; + responseHeaders: ResponseHeaders; + } + + interface OnBeforeRequestDetails { + id: number; + url: string; + method: string; + resourceType: string; + timestamp: number; + uploadData: UploadData[]; + } + + interface OnCompletedDetails { + id: number; + url: string; + method: string; + resourceType: string; + timestamp: number; + responseHeaders: ResponseHeaders; + fromCache: boolean; + statusCode: number; + statusLine: string; + } + + interface OnErrorOccurredDetails { + id: number; + url: string; + method: string; + resourceType: string; + timestamp: number; + fromCache: boolean; + /** + * The error description. + */ + error: string; + } + + interface OnResponseStartedDetails { + id: number; + url: string; + method: string; + resourceType: string; + timestamp: number; + responseHeaders: ResponseHeaders; + /** + * Indicates whether the response was fetched from disk cache. + */ + fromCache: boolean; + statusCode: number; + statusLine: string; + } + + interface OnSendHeadersDetails { + id: number; + url: string; + method: string; + resourceType: string; + timestamp: number; + requestHeaders: RequestHeaders; + } + + interface OpenDevToolsOptions { + /** + * Opens the devtools with specified dock state, can be , , , . Defaults to last + * used dock state. In mode it's possible to dock back. In mode it's not. + */ + mode: string; + } + + interface OpenDialogOptions { + title: string; + defaultPath: string; + /** + * Custom label for the confirmation button, when left empty the default label will + * be used. + */ + buttonLabel: string; + filters: string[]; + /** + * Contains which features the dialog should use, can contain , , , and . + */ + properties: string[]; + } + + interface OpenExternalOptions { + /** + * to bring the opened application to the foreground. The default is . + */ + activate: boolean; + } + + interface Parameters { + /** + * Specify the screen type to emulate (default: ) + */ + screenPosition: string; + /** + * Set the emulated screen size (screenPosition == mobile) + */ + screenSize: ScreenSize; + /** + * Position the view on the screen (screenPosition == mobile) (default: ) + */ + viewPosition: ViewPosition; + /** + * Set the device scale factor (if zero defaults to original device scale factor) + * (default: ) + */ + deviceScaleFactor: number; + /** + * Set the emulated view size (empty means no override) + */ + viewSize: ViewSize; + /** + * Whether emulated view should be scaled down if necessary to fit into available + * space (default: ) + */ + fitToView: boolean; + /** + * Offset of the emulated view inside available space (not in fit to view mode) + * (default: ) + */ + offset: Offset; + /** + * Scale of emulated view inside available space (not in fit to view mode) + * (default: ) + */ + scale: number; + } + + interface Point { + x: number; + y: number; + } + + interface Position { + x: number; + y: number; + } + + interface PrintOptions { + /** + * Don't ask user for print settings. Default is . + */ + silent: boolean; + /** + * Also prints the background color and image of the web page. Default is . + */ + printBackground: boolean; + } + + interface PrintToPDFOptions { + /** + * Specifies the type of margins to use. Uses 0 for default margin, 1 for no + * margin, and 2 for minimum margin. + */ + marginsType: number; + /** + * Specify page size of the generated PDF. Can be , , , , , or an Object containing + * and in microns. + */ + pageSize: string; + /** + * Whether to print CSS backgrounds. + */ + printBackground: boolean; + /** + * Whether to print selection only. + */ + printSelectionOnly: boolean; + /** + * for landscape, for portrait. + */ + landscape: boolean; + } + + interface ProcessMemoryInfo { + /** + * The amount of memory currently pinned to actual physical RAM. + */ + workingSetSize: number; + /** + * The maximum amount of memory that has ever been pinned to actual physical RAM. + */ + peakWorkingSetSize: number; + /** + * The amount of memory not shared by other processes, such as JS heap or HTML + * content. + */ + privateBytes: number; + /** + * The amount of memory shared between processes, typically memory consumed by the + * Electron code itself + */ + sharedBytes: number; + } + + interface ProgressBarOptions { + /** + * - Mode for the progress bar (, , , , or ) + */ + mode: string; + } + + interface ReadBookmark { + title: string; + url: string; + } + + interface Rect { + x: number; + y: number; + width: number; + height: number; + } + + interface RedirectRequest { + url: string; + method: string; + session?: Session; + uploadData?: UploadData; + } + + interface RegisterBufferProtocolRequest { + url: string; + referrer: string; + method: string; + uploadData: UploadData[]; + } + + interface RegisterFileProtocolRequest { + url: string; + referrer: string; + method: string; + uploadData: UploadData[]; + } + + interface RegisterHttpProtocolRequest { + url: string; + referrer: string; + method: string; + uploadData: UploadData[]; + } + + interface RegisterStringProtocolRequest { + url: string; + referrer: string; + method: string; + uploadData: UploadData[]; + } + + interface RegisterURLSchemeAsPrivilegedOptions { + /** + * Default true. + */ + secure?: boolean; + /** + * Default true. + */ + bypassCSP?: boolean; + /** + * Default true. + */ + allowServiceWorkers?: boolean; + /** + * Default true. + */ + supportFetchAPI?: boolean; + /** + * Default true. + */ + corsEnabled?: boolean; + } + + interface RelaunchOptions { + args?: string[]; + execPath?: string; + } + + interface Request { + method: string; + url: URL; + referrer: URL; + } + + interface Require { + module: string; + } + + interface ResizeOptions { + width?: number; + height?: number; + /** + * The desired quality of the resize image. Possible values are , or . The default + * is . These values express a desired quality/speed tradeoff. They are translated + * into an algorithm-specific method that depends on the capabilities (CPU, GPU) of + * the underlying platform. It is possible for all three methods to be mapped to + * the same algorithm on a given platform. + */ + quality?: string; + } + + interface ResourceUsage { + images: MemoryUsageDetails; + cssStyleSheets: MemoryUsageDetails; + xslStyleSheets: MemoryUsageDetails; + fonts: MemoryUsageDetails; + other: MemoryUsageDetails; + } + + interface Response { + cancel?: boolean; + /** + * The original request is prevented from being sent or completed and is instead + * redirected to the given URL. + */ + redirectURL?: string; + } + + interface Result { + requestId: number; + /** + * Position of the active match. + */ + activeMatchOrdinal: number; + /** + * Number of Matches. + */ + matches: number; + /** + * Coordinates of first match region. + */ + selectionArea: SelectionArea; + } + + interface SaveDialogOptions { + title: string; + defaultPath: string; + /** + * Custom label for the confirmation button, when left empty the default label will + * be used. + */ + buttonLabel: string; + filters: string[]; + } + + interface Settings { + /** + * to open the app at login, to remove the app as a login item. Defaults to . + */ + openAtLogin: boolean; + /** + * to open the app as hidden. Defaults to . The user can edit this setting from the + * System Preferences so should be checked when the app is opened to know the + * current value. This setting is only supported on macOS. + */ + openAsHidden: boolean; + } + + interface Size { + width: number; + height: number; + } + + interface SourcesOptions { + /** + * An array of Strings that lists the types of desktop sources to be captured, + * available types are and . + */ + types: string[]; + /** + * The suggested size that the media source thumbnail should be scaled to, defaults + * to . + */ + thumbnailSize?: ThumbnailSize; + } + + interface StartMonitoringOptions { + categoryFilter: string; + traceOptions: string; + } + + interface StartRecordingOptions { + categoryFilter: string; + traceOptions: string; + } + + interface SystemMemoryInfo { + /** + * The total amount of physical memory in Kilobytes available to the system. + */ + total: number; + /** + * The total amount of memory not being used by applications or disk cache. + */ + free: number; + /** + * The total amount of swap memory in Kilobytes available to the system. + */ + swapTotal: number; + /** + * The free amount of swap memory in Kilobytes available to the system. + */ + swapFree: number; + } + + interface WorkAreaSize { + height: number; + width: number; + } + + interface EditFlags { + /** + * Whether the renderer believes it can undo. + */ + canUndo: boolean; + /** + * Whether the renderer believes it can redo. + */ + canRedo: boolean; + /** + * Whether the renderer believes it can cut. + */ + canCut: boolean; + /** + * Whether the renderer believes it can copy + */ + canCopy: boolean; + /** + * Whether the renderer believes it can paste. + */ + canPaste: boolean; + /** + * Whether the renderer believes it can delete. + */ + canDelete: boolean; + /** + * Whether the renderer believes it can select all. + */ + canSelectAll: boolean; + } + + interface Extra { + } + + interface MediaFlags { + /** + * Whether the media element has crashed. + */ + inError: boolean; + /** + * Whether the media element is paused. + */ + isPaused: boolean; + /** + * Whether the media element is muted. + */ + isMuted: boolean; + /** + * Whether the media element has audio. + */ + hasAudio: boolean; + /** + * Whether the media element is looping. + */ + isLooping: boolean; + /** + * Whether the media element's controls are visible. + */ + isControlsVisible: boolean; + /** + * Whether the media element's controls are toggleable. + */ + canToggleControls: boolean; + /** + * Whether the media element can be rotated. + */ + canRotate: boolean; + } + + interface Offset { + /** + * Set the x axis offset from top left corner + */ + x: number; + /** + * Set the y axis offset from top left corner + */ + y: number; + } + + interface RequestHeaders { + } + + interface ResponseHeaders { + } + + interface ScreenSize { + /** + * Set the emulated screen width + */ + width: number; + /** + * Set the emulated screen height + */ + height: number; + } + + interface SelectionArea { + } + + interface ThumbnailSize { + } + + interface ViewPosition { + /** + * Set the x axis offset from top left corner + */ + x: number; + /** + * Set the y axis offset from top left corner + */ + y: number; + } + + interface ViewSize { + /** + * Set the emulated view width + */ + width: number; + /** + * Set the emulated view height + */ + height: number; + } + + interface WebPreferences { + /** + * Whether to enable DevTools. If it is set to , can not use to open DevTools. + * Default is . + */ + devTools: boolean; + /** + * Whether node integration is enabled. Default is . + */ + nodeIntegration: boolean; + /** + * Specifies a script that will be loaded before other scripts run in the page. + * This script will always have access to node APIs no matter whether node + * integration is turned on or off. The value should be the absolute file path to + * the script. When node integration is turned off, the preload script can + * reintroduce Node global symbols back to the global scope. See example . + */ + preload: string; + /** + * Sets the session used by the page. Instead of passing the Session object + * directly, you can also choose to use the option instead, which accepts a + * partition string. When both and are provided, will be preferred. Default is the + * default session. + */ + session: Session; + /** + * Sets the session used by the page according to the session's partition string. + * If starts with , the page will use a persistent session available to all pages + * in the app with the same . If there is no prefix, the page will use an in-memory + * session. By assigning the same , multiple pages can share the same session. + * Default is the default session. + */ + partition: string; + /** + * The default zoom factor of the page, represents . Default is . + */ + zoomFactor: number; + /** + * Enables JavaScript support. Default is . + */ + javascript: boolean; + /** + * When , it will disable the same-origin policy (usually using testing websites by + * people), and set and to if these two options are not set by user. Default is . + */ + webSecurity: boolean; + /** + * Allow an https page to display content like images from http URLs. Default is . + */ + allowDisplayingInsecureContent: boolean; + /** + * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is + * . + */ + allowRunningInsecureContent: boolean; + /** + * Enables image support. Default is . + */ + images: boolean; + /** + * Make TextArea elements resizable. Default is . + */ + textAreasAreResizable: boolean; + /** + * Enables WebGL support. Default is . + */ + webgl: boolean; + /** + * Enables WebAudio support. Default is . + */ + webaudio: boolean; + /** + * Whether plugins should be enabled. Default is . + */ + plugins: boolean; + /** + * Enables Chromium's experimental features. Default is . + */ + experimentalFeatures: boolean; + /** + * Enables Chromium's experimental canvas features. Default is . + */ + experimentalCanvasFeatures: boolean; + /** + * Enables scroll bounce (rubber banding) effect on macOS. Default is . + */ + scrollBounce: boolean; + /** + * A list of feature strings separated by , like to enable. The full list of + * supported feature strings can be found in the file. + */ + blinkFeatures: string; + /** + * A list of feature strings separated by , like to disable. The full list of + * supported feature strings can be found in the file. + */ + disableBlinkFeatures: string; + /** + * Sets the default font for the font-family. + */ + defaultFontFamily: DefaultFontFamily; + /** + * Defaults to . + */ + defaultFontSize: number; + /** + * Defaults to . + */ + defaultMonospaceFontSize: number; + /** + * Defaults to . + */ + minimumFontSize: number; + /** + * Defaults to . + */ + defaultEncoding: string; + /** + * Whether to throttle animations and timers when the page becomes background. + * Defaults to . + */ + backgroundThrottling: boolean; + /** + * Whether to enable offscreen rendering for the browser window. Defaults to . + */ + offscreen: boolean; + /** + * Whether to enable Chromium OS-level sandbox. + */ + sandbox: boolean; + } + + interface DefaultFontFamily { + /** + * Defaults to . + */ + standard: string; + /** + * Defaults to . + */ + serif: string; + /** + * Defaults to . + */ + sansSerif: string; + /** + * Defaults to . + */ + monospace: string; + } + +} + +declare module 'electron' { + const electron: Electron.AllElectron; + export = electron; +} + +interface NodeRequireFunction { + (moduleName: 'electron'): Electron.AllElectron; +} + +interface File { + /** + * The real path to the file on the users filesystem + */ + path: string; +} + +declare module 'original-fs' { + import * as fs from 'fs'; + + export = fs; +} diff --git a/npm/package.json b/npm/package.json index 79b08a8858e6..a4aff3358026 100644 --- a/npm/package.json +++ b/npm/package.json @@ -13,6 +13,7 @@ "electron": "cli.js" }, "main": "index.js", + "types": "electron.d.ts", "dependencies": { "extract-zip": "^1.0.3", "electron-download": "^3.0.1" @@ -31,4 +32,4 @@ "keywords": [ "electron" ] -} \ No newline at end of file +} From 8dde27af40bed43eec5ac8b9a5a875a7b9da4ef0 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Wed, 23 Nov 2016 09:23:36 -0800 Subject: [PATCH 307/328] update electron.d.ts to 0.0.8 --- npm/electron.d.ts | 962 +++++++++++++++++++++++++--------------------- 1 file changed, 531 insertions(+), 431 deletions(-) diff --git a/npm/electron.d.ts b/npm/electron.d.ts index 05debc16dcee..5ab2fc06afb6 100644 --- a/npm/electron.d.ts +++ b/npm/electron.d.ts @@ -1,9 +1,10 @@ -// Type definitions for Electron 0.0.6 +// Type definitions for Electron 1.4.8 // Project: http://electron.atom.io/ + declare namespace Electron { - class EventEmitter extends NodeJS.EventEmitter { + class EventEmitter { addListener(event: string, listener: Function): this; on(event: string, listener: Function): this; once(event: string, listener: Function): this; @@ -14,206 +15,104 @@ declare namespace Electron { listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; listenerCount(type: string): number; + prependListener(event: string, listener: Function): this; + prependOnceListener(event: string, listener: Function): this; + eventNames(): string[]; } class Accelerator extends String { } - /** - * DownloadItem represents a download item in Electron. - */ - interface DownloadItem extends NodeJS.EventEmitter { - /** - * Emitted when the download has been updated and is not done. - */ - on(event: 'updated', listener: (event: Event, state: 'progressing' | 'interrupted') => void): this; - /** - * Emits when the download is in a terminal state. This includes a completed download, - * a cancelled download (via downloadItem.cancel()), and interrupted download that can’t be resumed. - */ - on(event: 'done', listener: (event: Event, state: 'completed' | 'cancelled' | 'interrupted') => void): this; - on(event: string, listener: Function): this; - /** - * Set the save file path of the download item. - * Note: The API is only available in session’s will-download callback function. - * If user doesn’t set the save path via the API, Electron will use the original - * routine to determine the save path (Usually prompts a save dialog). - */ - setSavePath(path: string): void; - /** - * @returns The save path of the download item. - * This will be either the path set via downloadItem.setSavePath(path) or the path selected from the shown save dialog. - */ - getSavePath(): string; - /** - * Pauses the download. - */ - pause(): void; - /** - * @returns Whether the download is paused. - */ - isPaused(): boolean; - /** - * Resumes the download that has been paused. - */ - resume(): void; - /** - * @returns Whether the download can resume. - */ - canResume(): boolean; - /** - * Cancels the download operation. - */ - cancel(): void; - /** - * @returns The origin url where the item is downloaded from. - */ - getURL(): string; - /** - * @returns The mime type. - */ - getMimeType(): string; - /** - * @returns Whether the download has user gesture. - */ - hasUserGesture(): boolean; - /** - * @returns The file name of the download item. - * Note: The file name is not always the same as the actual one saved in local disk. - * If user changes the file name in a prompted download saving dialog, - * the actual name of saved file will be different. - */ - getFilename(): string; - /** - * @returns The total size in bytes of the download item. If the size is unknown, it returns 0. - */ - getTotalBytes(): number; - /** - * @returns The received bytes of the download item. - */ - getReceivedBytes(): number; - /** - * @returns The Content-Disposition field from the response header. - */ - getContentDisposition(): string; - /** - * @returns The current state. - */ - getState(): 'progressing' | 'completed' | 'cancelled' | 'interrupted'; - } - interface Event { preventDefault: Function; sender: WebContents; returnValue?: any; } + + interface CommonInterface { clipboard: Electron.Clipboard; crashReporter: Electron.CrashReporter; nativeImage: typeof Electron.NativeImage; NativeImage: typeof Electron.NativeImage; - shell: Electron.Shell; + process: Electron.Process; screen: Electron.Screen; - BluetoothDevice: Electron.BluetoothDevice; - Certificate: Electron.Certificate; - Cookie: Electron.Cookie; - DesktopCapturerSource: Electron.DesktopCapturerSource; - Display: Electron.Display; - JumpListCategory: Electron.JumpListCategory; - JumpListItem: Electron.JumpListItem; - MemoryUsageDetails: Electron.MemoryUsageDetails; - Rectangle: Electron.Rectangle; - ShortcutDetails: Electron.ShortcutDetails; - Task: Electron.Task; - ThumbarButton: Electron.ThumbarButton; - UploadData: Electron.UploadData; + shell: Electron.Shell; } interface MainInterface extends CommonInterface { app: Electron.App; autoUpdater: Electron.AutoUpdater; BrowserWindow: typeof Electron.BrowserWindow; - contentTracing: Electron.ContentTracing; - dialog: Electron.Dialog; - ipcMain: Electron.IpcMain; - globalShortcut: Electron.GlobalShortcut; - Menu: typeof Electron.Menu; - net: Electron.Net; ClientRequest: typeof Electron.ClientRequest; + contentTracing: Electron.ContentTracing; + Cookies: typeof Electron.Cookies; + Debugger: typeof Electron.Debugger; + dialog: Electron.Dialog; + DownloadItem: typeof Electron.DownloadItem; + globalShortcut: Electron.GlobalShortcut; IncomingMessage: typeof Electron.IncomingMessage; + ipcMain: Electron.IpcMain; + Menu: typeof Electron.Menu; MenuItem: typeof Electron.MenuItem; + net: Electron.Net; powerMonitor: Electron.PowerMonitor; powerSaveBlocker: Electron.PowerSaveBlocker; protocol: Electron.Protocol; session: typeof Electron.Session; Session: typeof Electron.Session; - Cookies: typeof Electron.Cookies; - WebRequest: typeof Electron.WebRequest; systemPreferences: Electron.SystemPreferences; Tray: typeof Electron.Tray; webContents: typeof Electron.WebContents; WebContents: typeof Electron.WebContents; - Debugger: typeof Electron.Debugger; - process: Electron.Process; + WebRequest: typeof Electron.WebRequest; } interface RendererInterface extends CommonInterface { + BrowserWindowProxy: typeof Electron.BrowserWindowProxy; desktopCapturer: Electron.DesktopCapturer; ipcRenderer: Electron.IpcRenderer; remote: Electron.Remote; webFrame: Electron.WebFrame; - BrowserWindowProxy: typeof Electron.BrowserWindowProxy; } interface AllElectron { - clipboard: Electron.Clipboard; - crashReporter: Electron.CrashReporter; - nativeImage: typeof Electron.NativeImage; - shell: Electron.Shell; app: Electron.App; autoUpdater: Electron.AutoUpdater; BrowserWindow: typeof Electron.BrowserWindow; - contentTracing: Electron.ContentTracing; - dialog: Electron.Dialog; - ipcMain: Electron.IpcMain; - globalShortcut: Electron.GlobalShortcut; - Menu: typeof Electron.Menu; - net: Electron.Net; + BrowserWindowProxy: typeof Electron.BrowserWindowProxy; ClientRequest: typeof Electron.ClientRequest; + clipboard: Electron.Clipboard; + contentTracing: Electron.ContentTracing; + Cookies: typeof Electron.Cookies; + crashReporter: Electron.CrashReporter; + Debugger: typeof Electron.Debugger; + desktopCapturer: Electron.DesktopCapturer; + dialog: Electron.Dialog; + DownloadItem: typeof Electron.DownloadItem; + globalShortcut: Electron.GlobalShortcut; IncomingMessage: typeof Electron.IncomingMessage; + ipcMain: Electron.IpcMain; + ipcRenderer: Electron.IpcRenderer; + Menu: typeof Electron.Menu; MenuItem: typeof Electron.MenuItem; + nativeImage: typeof Electron.NativeImage; + net: Electron.Net; powerMonitor: Electron.PowerMonitor; powerSaveBlocker: Electron.PowerSaveBlocker; + process: Electron.Process; protocol: Electron.Protocol; + remote: Electron.Remote; screen: Electron.Screen; session: typeof Electron.Session; - Cookies: typeof Electron.Cookies; - WebRequest: typeof Electron.WebRequest; + shell: Electron.Shell; systemPreferences: Electron.SystemPreferences; Tray: typeof Electron.Tray; webContents: typeof Electron.WebContents; - Debugger: typeof Electron.Debugger; - process: Electron.Process; - desktopCapturer: Electron.DesktopCapturer; - ipcRenderer: Electron.IpcRenderer; - remote: Electron.Remote; webFrame: Electron.WebFrame; - BrowserWindowProxy: typeof Electron.BrowserWindowProxy; - BluetoothDevice: Electron.BluetoothDevice; - Certificate: Electron.Certificate; - Cookie: Electron.Cookie; - DesktopCapturerSource: Electron.DesktopCapturerSource; - Display: Electron.Display; - JumpListCategory: Electron.JumpListCategory; - JumpListItem: Electron.JumpListItem; - MemoryUsageDetails: Electron.MemoryUsageDetails; - Rectangle: Electron.Rectangle; - ShortcutDetails: Electron.ShortcutDetails; - Task: Electron.Task; - ThumbarButton: Electron.ThumbarButton; - UploadData: Electron.UploadData; + WebRequest: typeof Electron.WebRequest; } interface App extends EventEmitter { @@ -240,7 +139,9 @@ declare namespace Electron { /** * Emitted before the application starts closing its windows. Calling * event.preventDefault() will prevent the default behaviour, which is terminating - * the application. + * the application. Note: If application quit was initiated by + * autoUpdater.quitAndInstall() then before-quit is emitted after emitting close + * event on all windows and closing them. */ on(event: 'before-quit', listener: (event: Event) => void): this; /** @@ -318,9 +219,10 @@ declare namespace Electron { on(event: 'open-file', listener: (event: Event, path: string) => void): this; /** - * Emitted when the user wants to open a URL with the application. The URL scheme - * must be registered to be opened by your application. You should call - * event.preventDefault() if you want to handle this event. + * Emitted when the user wants to open a URL with the application. Your + * application's Info.plist file must define the url scheme within the + * CFBundleURLTypes key, and set NSPrincipalClass to AtomApplication. You should + * call event.preventDefault() if you want to handle this event. */ on(event: 'open-url', listener: (event: Event, url: string) => void): this; @@ -383,29 +285,6 @@ declare namespace Electron { * from dock menu. */ addRecentDocument(path: string): void; - /** - * Append an argument to Chromium's command line. The argument will be quoted - * correctly. Note: This will not affect process.argv. - */ - appendArgument(value: string): void; - /** - * Append a switch (with optional value) to Chromium's command line. Note: This - * will not affect process.argv, and is mainly used by developers to control some - * low-level Chromium behaviors. - */ - appendSwitch(the_switch: string, value?: string): void; - /** - * When critical is passed, the dock icon will bounce until either the application - * becomes active or the request is canceled. When informational is passed, the - * dock icon will bounce for one second. However, the request remains active until - * either the application becomes active or the request is canceled. Returns an ID - * representing the request. - */ - bounce(type?: 'critical' | 'informational'): void; - /** - * Cancel the bounce of id. - */ - cancelBounce(id: number): void; /** * Clears the recent documents list. */ @@ -415,23 +294,18 @@ declare namespace Electron { * before app is ready. */ disableHardwareAcceleration(): void; - /** - * Bounces the Downloads stack if the filePath is inside the Downloads folder. - */ - downloadFinished(filePath: string): void; /** * Exits immediately with exitCode. exitCode defaults to 0. All windows will be * closed immediately without asking user and the before-quit and will-quit events * will not be emitted. */ - exit(exitCode?: number): void; + exit(exitCode: number): void; /** * On Linux, focuses on the first visible window. On macOS, makes the application * the active app. On Windows, focuses on the application's first window. */ focus(): void; getAppPath(): string; - getBadge(): string; getBadgeCount(): number; getCurrentActivityType(): string; getJumpListSettings(): JumpListSettings; @@ -461,10 +335,6 @@ declare namespace Electron { * Hides all application windows without minimizing them. */ hide(): void; - /** - * Hides the dock icon. - */ - hide(): void; /** * Imports the certificate in pkcs12 format into the platform certificate store. * callback is called with the result of import operation, a value of 0 indicates @@ -482,10 +352,9 @@ declare namespace Electron { * macOS machine. Please refer to Apple's documentation for details. The API uses * the Windows Registry and LSCopyDefaultHandlerForURLScheme internally. */ - isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; + isDefaultProtocolClient(protocol: string, path: string, args?: string[]): boolean; isReady(): boolean; isUnityRunning(): boolean; - isVisible(): boolean; /** * This method makes your application a Single Instance Application - instead of * allowing multiple instances of your app to run, this will ensure that only a @@ -527,7 +396,7 @@ declare namespace Electron { * restarting current instance immediately and adding a new command line argument * to the new instance: */ - relaunch(options?: RelaunchOptions): void; + relaunch(options: RelaunchOptions): void; /** * Releases all locks that were created by makeSingleInstance. This will allow * multiple instances of the application to once again run side by side. @@ -537,7 +406,7 @@ declare namespace Electron { * This method checks if the current executable as the default handler for a * protocol (aka URI scheme). If so, it will remove the app as the default handler. */ - removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; + removeAsDefaultProtocolClient(protocol: string, path: string, args?: string[]): boolean; /** * Set the about panel options. This will override the values defined in the app's * .plist file. See the Apple docs for more details. @@ -561,11 +430,7 @@ declare namespace Electron { * The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme * internally. */ - setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; - /** - * Sets the string to be displayed in the dock’s badging area. - */ - setBadge(text: string): void; + setAsDefaultProtocolClient(protocol: string, path: string, args?: string[]): boolean; /** * Sets the counter badge for current app. Setting the count to 0 will hide the * badge. On macOS it shows on the dock icon. On Linux it only works for Unity @@ -573,35 +438,26 @@ declare namespace Electron { * work, for more information please read Desktop Environment Integration. */ setBadgeCount(count: number): boolean; - /** - * Sets the image associated with this dock icon. - */ - setIcon(image: NativeImage): void; /** * Sets or removes a custom Jump List for the application, and returns one of the * following strings: If categories is null the previously set custom Jump List (if * any) will be replaced by the standard Jump List for the app (managed by - * Windows). JumpListCategory objects should have the following properties: Note: - * If a JumpListCategory object has neither the type nor the name property set then - * its type is assumed to be tasks. If the name property is set but the type - * property is omitted then the type is assumed to be custom. Note: Users can - * remove items from custom categories, and Windows will not allow a removed item - * to be added back into a custom category until after the next successful call to - * app.setJumpList(categories). Any attempt to re-add a removed item to a custom - * category earlier than that will result in the entire custom category being - * omitted from the Jump List. The list of removed items can be obtained using - * app.getJumpListSettings(). JumpListItem objects should have the following - * properties: Here's a very simple example of creating a custom Jump List: + * Windows). Note: If a JumpListCategory object has neither the type nor the name + * property set then its type is assumed to be tasks. If the name property is set + * but the type property is omitted then the type is assumed to be custom. Note: + * Users can remove items from custom categories, and Windows will not allow a + * removed item to be added back into a custom category until after the next + * successful call to app.setJumpList(categories). Any attempt to re-add a removed + * item to a custom category earlier than that will result in the entire custom + * category being omitted from the Jump List. The list of removed items can be + * obtained using app.getJumpListSettings(). Here's a very simple example of + * creating a custom Jump List: */ setJumpList(categories: JumpListCategory[]): void; /** * Set the app's login item settings. Note: This API has no effect on MAS builds. */ setLoginItemSettings(settings: Settings): void; - /** - * Sets the application's dock menu. - */ - setMenu(menu: Menu): void; /** * Overrides the current application's name. */ @@ -623,19 +479,17 @@ declare namespace Electron { setUserActivity(type: string, userInfo: any, webpageURL: string): void; /** * Adds tasks to the Tasks category of the JumpList on Windows. tasks is an array - * of Task objects in the following format: Task Object: Note: If you'd like to - * customize the Jump List even more use app.setJumpList(categories) instead. + * of Task objects. Note: If you'd like to customize the Jump List even more use + * app.setJumpList(categories) instead. */ setUserTasks(tasks: Task[]): boolean; - /** - * Shows the dock icon. - */ - show(): void; /** * Shows application windows after they were hidden. Does not automatically focus * them. */ show(): void; + commandLine: CommandLine; + dock: Dock; } interface AutoUpdater extends EventEmitter { @@ -676,7 +530,10 @@ declare namespace Electron { getFeedURL(): string; /** * Restarts the app and installs the update after it has been downloaded. It should - * only be called after update-downloaded has been emitted. + * only be called after update-downloaded has been emitted. Note: + * autoUpdater.quitAndInstall() will close all application windows first and only + * emit before-quit event on app after that. This is different from the normal quit + * event sequence. */ quitAndInstall(): void; /** @@ -847,10 +704,6 @@ declare namespace Electron { */ blur(): void; blurWebView(): void; - /** - * Same as webContents.capturePage([rect, ]callback). - */ - capturePage(callback: (image: NativeImage) => void): void; /** * Same as webContents.capturePage([rect, ]callback). */ @@ -919,10 +772,7 @@ declare namespace Electron { */ isClosable(): boolean; isDestroyed(): boolean; - /** - * Whether Boolean - Whether the window's document has been edited. - */ - isDocumentEdited(): void; + isDocumentEdited(): boolean; isFocused(): boolean; isFullScreen(): boolean; isFullScreenable(): boolean; @@ -957,7 +807,7 @@ declare namespace Electron { * ensure that file URLs are properly formatted, it is recommended to use Node's * url.format method: */ - loadURL(url: URL, options?: LoadURLOptions): void; + loadURL(url: string, options: LoadURLOptions): void; /** * Maximizes the window. */ @@ -970,7 +820,7 @@ declare namespace Electron { /** * Uses Quick Look to preview a file at a given path. */ - previewFile(path: string, displayName?: string): void; + previewFile(path: string, displayName: string): void; /** * Same as webContents.reload. */ @@ -984,7 +834,7 @@ declare namespace Electron { * setting this, the window is still a normal window, not a toolbox window which * can not be focused on. */ - setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver'): void; + setAlwaysOnTop(flag: boolean, level: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver'): void; /** * This will make a window maintain an aspect ratio. The extra size allows a * developer to have space, specified in pixels, not included within the aspect @@ -999,7 +849,7 @@ declare namespace Electron { * Just sum any extra width and height areas you have within the overall content * view. */ - setAspectRatio(aspectRatio: number, extraSize?: ExtraSize): void; + setAspectRatio(aspectRatio: number, extraSize: ExtraSize): void; /** * Sets whether the window menu bar should hide itself automatically. Once set the * menu bar will only show when users press the single Alt key. If the menu bar is @@ -1009,7 +859,7 @@ declare namespace Electron { /** * Resizes and moves the window to the supplied bounds */ - setBounds(bounds: Rectangle, animate?: boolean): void; + setBounds(bounds: Rectangle, animate: boolean): void; /** * Sets whether the window can be manually closed by user. On Linux does nothing. */ @@ -1018,7 +868,7 @@ declare namespace Electron { * Resizes and moves the window's client area (e.g. the web page) to the supplied * bounds. */ - setContentBounds(bounds: Rectangle, animate?: boolean): void; + setContentBounds(bounds: Rectangle, animate: boolean): void; /** * Prevents the window contents from being captured by other apps. On macOS it sets * the NSWindow's sharingType to NSWindowSharingNone. On Windows it calls @@ -1028,7 +878,7 @@ declare namespace Electron { /** * Resizes the window's client area (e.g. the web page) to width and height. */ - setContentSize(width: number, height: number, animate?: boolean): void; + setContentSize(width: number, height: number, animate: boolean): void; /** * Specifies whether the window’s document has been edited, and the icon in title * bar will become gray when set to true. @@ -1110,7 +960,7 @@ declare namespace Electron { /** * Moves window to x and y. */ - setPosition(x: number, y: number, animate?: boolean): void; + setPosition(x: number, y: number, animate: boolean): void; /** * Sets progress value in progress bar. Valid range is [0, 1.0]. Remove progress * bar when progress < 0; Change to indeterminate mode when progress > 1. On Linux @@ -1121,7 +971,7 @@ declare namespace Electron { * without a mode set (but with a value within the valid range), normal will be * assumed. */ - setProgressBar(progress: number, options?: ProgressBarOptions): void; + setProgressBar(progress: number, options: ProgressBarOptions): void; /** * Sets the pathname of the file the window represents, and the icon of the file * will show in window's title bar. @@ -1136,11 +986,11 @@ declare namespace Electron { * attached just below the window frame, but you may want to display them beneath a * HTML-rendered toolbar. For example: */ - setSheetOffset(offsetY: number, offsetX?: number): void; + setSheetOffset(offsetY: number, offsetX: number): void; /** * Resizes the window to width and height. */ - setSize(width: number, height: number, animate?: boolean): void; + setSize(width: number, height: number, animate: boolean): void; /** * Makes the window not show in the taskbar. */ @@ -1171,6 +1021,11 @@ declare namespace Electron { * Changes the title of native window to title. */ setTitle(title: string): void; + /** + * Adds a vibrancy effect to the browser window. Passing null or an empty string + * will remove the vibrancy effect on the window. + */ + setVibrancy(type: 'appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark'): void; /** * Sets whether the window should be visible on all workspaces. Note: This API does * nothing on Windows. @@ -1243,13 +1098,28 @@ declare namespace Electron { data: string; fingerprint: string; + issuer: CertificatePrincipal; + issuerCert: Certificate; issuerName: string; serialNumber: string; + subject: CertificatePrincipal; subjectName: string; validExpiry: number; validStart: number; } + type CertificatePrincipal = { + + // Docs: http://electron.atom.io/docs/api/structures/certificate-principal + + commonName: string; + country: string; + locality: string; + organizations: string[]; + organizationUnits: string[]; + state: string; + } + class ClientRequest extends EventEmitter { // Docs: http://electron.atom.io/docs/api/client-request @@ -1303,7 +1173,7 @@ declare namespace Electron { * Sends the last chunk of the request data. Subsequent write or end operations * will not be allowed. The finish event is emitted just after the end operation. */ - end(chunk?: string | Buffer, encoding?: string, callback?: Function): void; + end(chunk: string | Buffer, encoding: string, callback: Function): void; /** * Returns String - The value of a previously set extra header name. */ @@ -1329,7 +1199,7 @@ declare namespace Electron { * issued on the wire. After the first write operation, it is not allowed to add or * remove a custom header. */ - write(chunk: string | Buffer, encoding?: string, callback?: Function): void; + write(chunk: string | Buffer, encoding: string, callback: Function): void; chunkedEncoding: boolean; } @@ -1337,13 +1207,13 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/clipboard - availableFormats(type?: string): string[]; + availableFormats(type: string): string[]; /** * Clears the clipboard content. */ - clear(type?: string): void; - has(data: string, type?: string): boolean; - read(data: string, type?: string): string; + clear(type: string): void; + has(data: string, type: string): boolean; + read(data: string, type: string): string; /** * Returns an Object containing title and url keys representing the bookmark in the * clipboard. The title and url values will be empty strings when the bookmark is @@ -1351,20 +1221,20 @@ declare namespace Electron { */ readBookmark(): ReadBookmark; readFindText(): string; - readHTML(type?: string): string; - readImage(type?: string): NativeImage; - readRTF(type?: string): string; - readText(type?: string): string; + readHTML(type: string): string; + readImage(type: string): NativeImage; + readRTF(type: string): string; + readText(type: string): string; /** * Writes data to the clipboard. */ - write(data: Data, type?: string): void; + write(data: Data, type: string): void; /** * Writes the title and url into the clipboard as a bookmark. Note: Most apps on * Windows don't support pasting bookmarks into them so you can use clipboard.write * to write both a bookmark and fallback text to the clipboard. */ - writeBookmark(title: string, url: string, type?: string): void; + writeBookmark(title: string, url: string, type: string): void; /** * Writes the text into the find pasteboard as plain text. This method uses * synchronous IPC when called from the renderer process. @@ -1373,19 +1243,19 @@ declare namespace Electron { /** * Writes markup to the clipboard. */ - writeHTML(markup: string, type?: string): void; + writeHTML(markup: string, type: string): void; /** * Writes image to the clipboard. */ - writeImage(image: NativeImage, type?: string): void; + writeImage(image: NativeImage, type: string): void; /** * Writes the text into the clipboard in RTF. */ - writeRTF(text: string, type?: string): void; + writeRTF(text: string, type: string): void; /** * Writes the text into the clipboard as plain text. */ - writeText(text: string, type?: string): void; + writeText(text: string, type: string): void; } interface ContentTracing extends EventEmitter { @@ -1472,7 +1342,7 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/structures/cookie domain: string; - expirationDate?: number; + expirationDate: number; hostOnly: string; httpOnly: boolean; name: string; @@ -1521,6 +1391,14 @@ declare namespace Electron { set(details: Details, callback: (error: Error) => void): void; } + type CrashReport = { + + // Docs: http://electron.atom.io/docs/api/structures/crash-report + + date: string; + ID: number; + } + interface CrashReporter extends EventEmitter { // Docs: http://electron.atom.io/docs/api/crash-reporter @@ -1529,12 +1407,12 @@ declare namespace Electron { * Returns the date and ID of the last crash report. If no crash reports have been * sent or the crash reporter has not been started, null is returned. */ - getLastCrashReport(): LastCrashReport; + getLastCrashReport(): CrashReport; /** * Returns all uploaded crash reports. Each report contains the date and uploaded * ID. */ - getUploadedReports(): Object[]; + getUploadedReports(): CrashReport[]; /** * You are required to call this method before using other crashReporter APIs. * Note: On macOS, Electron uses a new crashpad client, which is different from @@ -1575,7 +1453,7 @@ declare namespace Electron { /** * Attaches the debugger to the webContents. */ - attach(protocolVersion?: string): void; + attach(protocolVersion: string): void; /** * Detaches the debugger from the webContents. */ @@ -1584,7 +1462,7 @@ declare namespace Electron { /** * Send given command to the debugging target. */ - sendCommand(method: string, commandParams?: any, callback?: (error: any, result: any) => void): void; + sendCommand(method: string, commandParams: any, callback: (error: any, result: any) => void): void; } interface DesktopCapturer extends EventEmitter { @@ -1625,61 +1503,25 @@ declare namespace Electron { * It returns the index of the clicked button. If a callback is passed, the API * call will be asynchronous and the result will be passed via callback(response). */ - showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions, callback: (response: number) => void): void; + showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions, callback: (response: number) => void): number; /** - * Shows a message box, it will block the process until the message box is closed. - * It returns the index of the clicked button. If a callback is passed, the API - * call will be asynchronous and the result will be passed via callback(response). + * The filters specifies an array of file types that can be displayed or selected + * when you want to limit the user to a specific type. For example: The extensions + * array should contain extensions without wildcards or dots (e.g. 'png' is good + * but '.png' and '*.png' are bad). To show all files, use the '*' wildcard (no + * other wildcard is supported). If a callback is passed, the API call will be + * asynchronous and the result will be passed via callback(filenames) Note: On + * Windows and Linux an open dialog can not be both a file selector and a directory + * selector, so if you set properties to ['openFile', 'openDirectory'] on these + * platforms, a directory selector will be shown. */ - showMessageBox(options: MessageBoxOptions, callback: (response: number) => void): void; + showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions, callback: (filePaths: string[]) => void): string[]; /** - * Shows a message box, it will block the process until the message box is closed. - * It returns the index of the clicked button. If a callback is passed, the API - * call will be asynchronous and the result will be passed via callback(response). + * The filters specifies an array of file types that can be displayed, see + * dialog.showOpenDialog for an example. If a callback is passed, the API call will + * be asynchronous and the result will be passed via callback(filename) */ - showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions, callback: (response: number) => void): void; - /** - * On success this method returns an array of file paths chosen by the user, - * otherwise it returns undefined. The filters specifies an array of file types - * that can be displayed or selected when you want to limit the user to a specific - * type. For example: The extensions array should contain extensions without - * wildcards or dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show - * all files, use the '*' wildcard (no other wildcard is supported). If a callback - * is passed, the API call will be asynchronous and the result will be passed via - * callback(filenames) Note: On Windows and Linux an open dialog can not be both a - * file selector and a directory selector, so if you set properties to ['openFile', - * 'openDirectory'] on these platforms, a directory selector will be shown. - */ - showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions, callback?: (filePaths: string[]) => void): void; - /** - * On success this method returns an array of file paths chosen by the user, - * otherwise it returns undefined. The filters specifies an array of file types - * that can be displayed or selected when you want to limit the user to a specific - * type. For example: The extensions array should contain extensions without - * wildcards or dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show - * all files, use the '*' wildcard (no other wildcard is supported). If a callback - * is passed, the API call will be asynchronous and the result will be passed via - * callback(filenames) Note: On Windows and Linux an open dialog can not be both a - * file selector and a directory selector, so if you set properties to ['openFile', - * 'openDirectory'] on these platforms, a directory selector will be shown. - */ - showOpenDialog(options: OpenDialogOptions, callback?: (filePaths: string[]) => void): void; - /** - * On success this method returns the path of the file chosen by the user, - * otherwise it returns undefined. The filters specifies an array of file types - * that can be displayed, see dialog.showOpenDialog for an example. If a callback - * is passed, the API call will be asynchronous and the result will be passed via - * callback(filename) - */ - showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions, callback?: (filename: string) => void): void; - /** - * On success this method returns the path of the file chosen by the user, - * otherwise it returns undefined. The filters specifies an array of file types - * that can be displayed, see dialog.showOpenDialog for an example. If a callback - * is passed, the API call will be asynchronous and the result will be passed via - * callback(filename) - */ - showSaveDialog(options: SaveDialogOptions, callback?: (filename: string) => void): void; + showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions, callback: (filename: string) => void): string; } type Display = { @@ -1696,6 +1538,73 @@ declare namespace Electron { workAreaSize: WorkAreaSize; } + class DownloadItem extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/download-item + + /** + * Emitted when the download is in a terminal state. This includes a completed + * download, a cancelled download (via downloadItem.cancel()), and interrupted + * download that can't be resumed. The state can be one of following: + */ + on(event: 'done', listener: (event: Event, + state: string) => void): this; + /** + * Emitted when the download has been updated and is not done. The state can be one + * of following: + */ + on(event: 'updated', listener: (event: Event, + state: string) => void): this; + /** + * Cancels the download operation. + */ + cancel(): void; + /** + * Resumes Boolean - Whether the download can resume. + */ + canResume(): void; + getContentDisposition(): string; + /** + * Note: The file name is not always the same as the actual one saved in local + * disk. If user changes the file name in a prompted download saving dialog, the + * actual name of saved file will be different. + */ + getFilename(): string; + getMimeType(): string; + getReceivedBytes(): number; + getSavePath(): string; + getState(): string; + /** + * If the size is unknown, it returns 0. + */ + getTotalBytes(): number; + getURL(): string; + hasUserGesture(): boolean; + isPaused(): boolean; + /** + * Pauses the download. + */ + pause(): void; + /** + * Resumes the download that has been paused. + */ + resume(): void; + /** + * The API is only available in session's will-download callback function. If user + * doesn't set the save path via the API, Electron will use the original routine to + * determine the save path(Usually prompts a save dialog). + */ + setSavePath(path: string): void; + } + + type FileFilter = { + + // Docs: http://electron.atom.io/docs/api/structures/file-filter + + extensions: string[]; + name: string; + } + interface GlobalShortcut extends EventEmitter { // Docs: http://electron.atom.io/docs/api/global-shortcut @@ -1762,20 +1671,79 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/ipc-main + /** + * Listens to channel, when a new message arrives listener would be called with + * listener(event, args...). + */ + on(channel: string, listener: Function): this; + /** + * Adds a one time listener function for the event. This listener is invoked only + * the next time a message is sent to channel, after which it is removed. + */ + once(channel: string, listener: Function): this; + /** + * Removes all listeners, or those of the specified channel. + */ + removeAllListeners(channel: string): this; + /** + * Removes the specified listener from the listener array for the specified + * channel. + */ + removeListener(channel: string, listener: Function): this; } interface IpcRenderer extends EventEmitter { // Docs: http://electron.atom.io/docs/api/ipc-renderer + /** + * Listens to channel, when a new message arrives listener would be called with + * listener(event, args...). + */ + on(channel: string, listener: Function): this; + /** + * Adds a one time listener function for the event. This listener is invoked only + * the next time a message is sent to channel, after which it is removed. + */ + once(channel: string, listener: Function): this; + /** + * Removes all listeners, or those of the specified channel. + */ + removeAllListeners(channel: string): this; + /** + * Removes the specified listener from the listener array for the specified + * channel. + */ + removeListener(channel: string, listener: Function): this; + /** + * Send a message to the main process asynchronously via channel, you can also send + * arbitrary arguments. Arguments will be serialized in JSON internally and hence + * no functions or prototype chain will be included. The main process handles it by + * listening for channel with ipcMain module. + */ + send(channel: string, ...args: any[]): void; + /** + * Send a message to the main process synchronously via channel, you can also send + * arbitrary arguments. Arguments will be serialized in JSON internally and hence + * no functions or prototype chain will be included. The main process handles it by + * listening for channel with ipcMain module, and replies by setting + * event.returnValue. Note: Sending a synchronous message will block the whole + * renderer process, unless you know what you are doing you should never use it. + */ + sendSync(channel: string, ...args: any[]): void; + /** + * Like ipcRenderer.send but the event will be sent to the element in the + * host page instead of the main process. + */ + sendToHost(channel: string, ...args: any[]): void; } type JumpListCategory = { // Docs: http://electron.atom.io/docs/api/structures/jump-list-category - items: JumpListItem[]; - name: string; + items?: JumpListItem[]; + name?: string; type: string; } @@ -1783,13 +1751,13 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/structures/jump-list-item - args: string; - description: string; + args?: string; + description?: string; iconIndex: number; iconPath: string; - path: string; - program: string; - title: string; + path?: string; + program?: string; + title?: string; type: string; } @@ -1816,11 +1784,8 @@ declare namespace Electron { * element of the template and they will become properties of the constructed menu * items. */ - static buildFromTemplate(template: MenuItem[]): void; - /** - * Returns the application menu (an instance of Menu), if set, or null, if not set. - */ - static getApplicationMenu(): void; + static buildFromTemplate(template: MenuItemConstructorOptions[]): Menu; + static getApplicationMenu(): Menu; /** * Sends the action to the first responder of application. This is used for * emulating default Cocoa menu behaviors, usually you would just use the role @@ -1845,7 +1810,11 @@ declare namespace Electron { /** * Pops up this menu as a context menu in the browserWindow. */ - popup(browserWindow?: BrowserWindow, x?: number, y?: number, positioningItem?: number): void; + popup(browserWindow: BrowserWindow, x: number, y?: number, positioningItem: number): void; + /** + * Pops up this menu as a context menu in the browserWindow. + */ + popup(browserWindow: BrowserWindow, x: number, positioningItem: number): void; items: MenuItem[]; } @@ -1870,7 +1839,7 @@ declare namespace Electron { /** * Creates a new NativeImage instance from buffer. The default scaleFactor is 1.0. */ - static createFromBuffer(buffer: Buffer, scaleFactor?: number): NativeImage; + static createFromBuffer(buffer: Buffer, scaleFactor: number): NativeImage; /** * Creates a new NativeImage instance from dataURL. */ @@ -2004,6 +1973,14 @@ declare namespace Electron { * whichever is lower for the current process. */ setFdLimit(maxDescriptors: number): void; + chrome: any; + defaultApp: any; + electron: any; + mas: any; + noAsar: any; + resourcesPath: any; + type: any; + windowsStore: any; } interface Protocol extends EventEmitter { @@ -2014,22 +1991,22 @@ declare namespace Electron { * Intercepts scheme protocol and uses handler as the protocol's new handler which * sends a Buffer as a response. */ - interceptBufferProtocol(scheme: string, handler: (request: InterceptBufferProtocolRequest, callback: (buffer?: Buffer) => void) => void, completion?: (error: Error) => void): void; + interceptBufferProtocol(scheme: string, handler: (request: InterceptBufferProtocolRequest, callback: (buffer: Buffer) => void) => void, completion: (error: Error) => void): void; /** * Intercepts scheme protocol and uses handler as the protocol's new handler which * sends a file as a response. */ - interceptFileProtocol(scheme: string, handler: (request: InterceptFileProtocolRequest, callback: (filePath: string) => void) => void, completion?: (error: Error) => void): void; + interceptFileProtocol(scheme: string, handler: (request: InterceptFileProtocolRequest, callback: (filePath: string) => void) => void, completion: (error: Error) => void): void; /** * Intercepts scheme protocol and uses handler as the protocol's new handler which * sends a new HTTP request as a response. */ - interceptHttpProtocol(scheme: string, handler: (request: InterceptHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void; + interceptHttpProtocol(scheme: string, handler: (request: InterceptHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion: (error: Error) => void): void; /** * Intercepts scheme protocol and uses handler as the protocol's new handler which * sends a String as a response. */ - interceptStringProtocol(scheme: string, handler: (request: InterceptStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void; + interceptStringProtocol(scheme: string, handler: (request: InterceptStringProtocolRequest, callback: (data: string) => void) => void, completion: (error: Error) => void): void; /** * The callback will be called with a boolean that indicates whether there is * already a handler for scheme. @@ -2041,7 +2018,7 @@ declare namespace Electron { * with either a Buffer object or an object that has the data, mimeType, and * charset properties. Example: */ - registerBufferProtocol(scheme: string, handler: (request: RegisterBufferProtocolRequest, callback: (buffer?: Buffer) => void) => void, completion?: (error: Error) => void): void; + registerBufferProtocol(scheme: string, handler: (request: RegisterBufferProtocolRequest, callback: (buffer: Buffer) => void) => void, completion: (error: Error) => void): void; /** * Registers a protocol of scheme that will send the file as a response. The * handler will be called with handler(request, callback) when a request is going @@ -2057,7 +2034,7 @@ declare namespace Electron { * want to call protocol.registerStandardSchemes to have your scheme treated as a * standard scheme. */ - registerFileProtocol(scheme: string, handler: (request: RegisterFileProtocolRequest, callback: (filePath?: string) => void) => void, completion?: (error: Error) => void): void; + registerFileProtocol(scheme: string, handler: (request: RegisterFileProtocolRequest, callback: (filePath: string) => void) => void, completion: (error: Error) => void): void; /** * Registers a protocol of scheme that will send an HTTP request as a response. The * usage is the same with registerFileProtocol, except that the callback should be @@ -2066,7 +2043,7 @@ declare namespace Electron { * current session. If you want the request to have a different session you should * set session to null. For POST requests the uploadData object must be provided. */ - registerHttpProtocol(scheme: string, handler: (request: RegisterHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void; + registerHttpProtocol(scheme: string, handler: (request: RegisterHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion: (error: Error) => void): void; registerServiceWorkerSchemes(schemes: string[]): void; /** * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example @@ -2091,15 +2068,15 @@ declare namespace Electron { * with either a String or an object that has the data, mimeType, and charset * properties. */ - registerStringProtocol(scheme: string, handler: (request: RegisterStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void; + registerStringProtocol(scheme: string, handler: (request: RegisterStringProtocolRequest, callback: (data: string) => void) => void, completion: (error: Error) => void): void; /** * Remove the interceptor installed for scheme and restore its original handler. */ - uninterceptProtocol(scheme: string, completion?: (error: Error) => void): void; + uninterceptProtocol(scheme: string, completion: (error: Error) => void): void; /** * Unregisters the custom protocol of scheme. */ - unregisterProtocol(scheme: string, completion?: (error: Error) => void): void; + unregisterProtocol(scheme: string, completion: (error: Error) => void): void; } type Rectangle = { @@ -2119,7 +2096,8 @@ declare namespace Electron { getCurrentWebContents(): WebContents; getCurrentWindow(): BrowserWindow; getGlobal(name: string): any; - require(module: string): Require; + require(module: string): any; + process: any; } interface Screen extends EventEmitter { @@ -2167,6 +2145,7 @@ declare namespace Electron { * before. There is no way to change the options of an existing Session object. */ static fromPartition(partition: string, options: FromPartitionOptions): Session; + static defaultSession: Session; /** * Emitted when Electron is about to download item in webContents. Calling * event.preventDefault() will cancel the download and item will not be available @@ -2182,7 +2161,7 @@ declare namespace Electron { /** * Clears the data of web storages. */ - clearStorageData(options?: ClearStorageDataOptions, callback?: Function): void; + clearStorageData(options: ClearStorageDataOptions, callback: Function): void; /** * Writes any unwritten DOMStorage data to disk. */ @@ -2219,7 +2198,7 @@ declare namespace Electron { * Open the given external protocol URL in the desktop's default manner. (For * example, mailto: URLs in the user's default mail agent). */ - openExternal(url: string, options?: OpenExternalOptions): boolean; + openExternal(url: string, options: OpenExternalOptions, callback: (error: Error) => void): boolean; /** * Open the given file in the desktop's default manner. */ @@ -2237,22 +2216,18 @@ declare namespace Electron { * Creates or updates a shortcut link at shortcutPath. */ writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean; - /** - * Creates or updates a shortcut link at shortcutPath. - */ - writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean; } type ShortcutDetails = { // Docs: http://electron.atom.io/docs/api/structures/shortcut-details - appUserModelId?: string; - args?: string; - cwd?: string; - description?: string; - icon?: string; - iconIndex?: number; + appUserModelId: string; + args: string; + cwd: string; + description: string; + icon: string; + iconIndex: number; target: string; } @@ -2343,7 +2318,7 @@ declare namespace Electron { click: Function; flags?: string[]; icon: NativeImage; - tooltip?: string; + tooltip: string; } class Tray extends EventEmitter { @@ -2419,7 +2394,7 @@ declare namespace Electron { * The bounds of tray icon */ bounds: Rectangle) => void): this; - constructor(image: NativeImage); + constructor(image: NativeImage | string); /** * Destroys the tray icon immediately. */ @@ -2438,7 +2413,7 @@ declare namespace Electron { * shown instead of the tray icon's context menu. The position is only available on * Windows, and it is (0, 0) by default. */ - popUpContextMenu(menu?: Menu, position?: Position): void; + popUpContextMenu(menu: Menu, position: Position): void; /** * Sets the context menu for this icon. */ @@ -2467,6 +2442,14 @@ declare namespace Electron { setToolTip(toolTip: string): void; } + type UploadBlob = { + + // Docs: http://electron.atom.io/docs/api/structures/upload-blob + + blobUUID: string; + type: string; + } + type UploadData = { // Docs: http://electron.atom.io/docs/api/structures/upload-data @@ -2476,6 +2459,36 @@ declare namespace Electron { file: string; } + type UploadFile = { + + // Docs: http://electron.atom.io/docs/api/structures/upload-file + + filePath: string; + length: number; + modificationTime: number; + offset: number; + type: string; + } + + type UploadFileSystem = { + + // Docs: http://electron.atom.io/docs/api/structures/upload-file-system + + filsSystemURL: string; + length: number; + modificationTime: number; + offset: number; + type: string; + } + + type UploadRawData = { + + // Docs: http://electron.atom.io/docs/api/structures/upload-raw-data + + bytes: Buffer; + type: string; + } + class WebContents extends EventEmitter { // Docs: http://electron.atom.io/docs/api/web-contents @@ -2519,19 +2532,19 @@ declare namespace Electron { */ on(event: 'cursor-changed', listener: (event: Event, type: string, - image?: NativeImage, + image: NativeImage, /** * scaling factor for the custom cursor */ - scale?: number, + scale: number, /** * the size of the `image` */ - size?: Size, + size: Size, /** * coordinates of the custom cursor's hotspot */ - hotspot?: Hotspot) => void): this; + hotspot: Hotspot) => void): this; /** * Emitted when webContents is destroyed. */ @@ -2548,6 +2561,10 @@ declare namespace Electron { * Emitted when DevTools is opened. */ on(event: 'devtools-opened', listener: Function): this; + /** + * Emitted when the devtools window instructs the webContents to reload + */ + on(event: 'devtools-reload-page', listener: Function): this; /** * Emitted when a page's theme color changes. This is usually due to encountering a * meta tag: @@ -2627,7 +2644,7 @@ declare namespace Electron { */ on(event: 'dom-ready', listener: (event: Event) => void): this; /** - * Emitted when a result is available for webContents.findInPage request. + * Emitted when a result is available for [webContents.findInPage] request. */ on(event: 'found-in-page', listener: (event: Event, result: Result) => void): this; @@ -2735,19 +2752,6 @@ declare namespace Electron { * creation: */ addWorkSpace(path: string): void; - /** - * Begin subscribing for presentation events and captured frames, the callback will - * be called with callback(frameBuffer, dirtyRect) when there is a presentation - * event. The frameBuffer is a Buffer that contains raw pixel data. On most - * machines, the pixel data is effectively stored in 32bit BGRA format, but the - * actual representation depends on the endianness of the processor (most modern - * processors are little-endian, on machines with big-endian processors the data is - * in 32bit ARGB format). The dirtyRect is an object with x, y, width, height - * properties that describes which part of the page was repainted. If onlyDirty is - * set to true, frameBuffer will only contain the repainted area. onlyDirty - * defaults to false. - */ - beginFrameSubscription(callback: (frameBuffer: Buffer, dirtyRect: Rectangle) => void): void; /** * Begin subscribing for presentation events and captured frames, the callback will * be called with callback(frameBuffer, dirtyRect) when there is a presentation @@ -2770,12 +2774,6 @@ declare namespace Electron { * data of the snapshot. Omitting rect will capture the whole visible page. */ capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; - /** - * Captures a snapshot of the page within rect. Upon completion callback will be - * called with callback(image). The image is an instance of NativeImage that stores - * data of the snapshot. Omitting rect will capture the whole visible page. - */ - capturePage(callback: (image: NativeImage) => void): void; /** * Clears the navigation history. */ @@ -2820,15 +2818,18 @@ declare namespace Electron { /** * Evaluates code in page. In the browser window some HTML APIs like * requestFullScreen can only be invoked by a gesture from the user. Setting - * userGesture to true will remove this limitation. + * userGesture to true will remove this limitation. If the result of the executed + * code is a promise the callback result will be the resolved value of the promise. + * We recommend that you use the returned Promise to handle code that results in a + * Promise. */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): void; + executeJavaScript(code: string, userGesture: boolean, callback: (result: any) => void): Promise; /** * Starts a request to find all matches for the text in the web page and returns an * Integer representing the request id used for the request. The result of the * request can be obtained by subscribing to found-in-page event. */ - findInPage(text: string, options?: FindInPageOptions): void; + findInPage(text: string, options: FindInPageOptions): void; getFrameRate(): number; getTitle(): string; getURL(): string; @@ -2901,11 +2902,11 @@ declare namespace Electron { * http:// or file://. If the load should bypass http cache then use the pragma * header to achieve it. */ - loadURL(url: URL, options?: LoadURLOptions): void; + loadURL(url: URL, options: LoadURLOptions): void; /** * Opens the devtools. */ - openDevTools(options?: OpenDevToolsOptions): void; + openDevTools(options: OpenDevToolsOptions): void; /** * Executes the editing command paste in web page. */ @@ -2921,7 +2922,7 @@ declare namespace Electron { * false, printBackground: false}). Use page-break-before: always; CSS style to * force to print to a new page. */ - print(options?: PrintOptions): void; + print(options: PrintOptions): void; /** * Prints window's web page as PDF with Chromium's preview printing custom * settings. The callback will be called with callback(error, data) on completion. @@ -2969,7 +2970,7 @@ declare namespace Electron { * handle the message by listening to channel with the ipcRenderer module. An * example of sending messages from the main process to the renderer process: */ - send(channel: string): void; + send(channel: string, ...args: any[]): void; /** * Sends an input event to the page. For keyboard events, the event object also * have following properties: For mouse events, the event object also have @@ -2986,10 +2987,22 @@ declare namespace Electron { * Only values between 1 and 60 are accepted. */ setFrameRate(fps: number): void; + /** + * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level. + */ + setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; + /** + * Set the size of the page. This is only supported for guest contents. + */ + setSize(options: SizeOptions): void; /** * Overrides the user agent for this web page. */ setUserAgent(userAgent: string): void; + /** + * Sets the maximum and minimum pinch-to-zoom level. + */ + setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; /** * Changes the zoom factor to the specified factor. Zoom factor is zoom percent * divided by 100, so 300% = 3.0. @@ -3002,7 +3015,8 @@ declare namespace Electron { */ setZoomLevel(level: number): void; /** - * Sets the maximum and minimum zoom level. + * Deprecated: Call setVisualZoomLevelLimits instead to set the visual zoom level + * limits. This method will be removed in Electron 2.0. */ setZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; /** @@ -3074,7 +3088,7 @@ declare namespace Electron { * requestFullScreen can only be invoked by a gesture from the user. Setting * userGesture to true will remove this limitation. */ - executeJavaScript(code: string, userGesture?: boolean): void; + executeJavaScript(code: string, userGesture: boolean): void; /** * Returns an object describing usage information of Blink's internal memory * caches. This will generate: @@ -3097,19 +3111,27 @@ declare namespace Electron { * the value of false to omit it from the registration. An example of registering a * privileged scheme, without bypassing Content Security Policy: */ - registerURLSchemeAsPrivileged(scheme: string, options?: RegisterURLSchemeAsPrivilegedOptions): void; + registerURLSchemeAsPrivileged(scheme: string, options: RegisterURLSchemeAsPrivilegedOptions): void; /** * Registers the scheme as secure scheme. Secure schemes do not trigger mixed * content warnings. For example, https and data are secure schemes because they * cannot be corrupted by active network attackers. */ registerURLSchemeAsSecure(scheme: string): void; + /** + * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level. + */ + setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; /** * Sets a provider for spell checking in input fields and text areas. The provider * must be an object that has a spellCheck method that returns whether the word * passed is correctly spelled. An example of using node-spellchecker as provider: */ setSpellCheckProvider(language: string, autoCorrectWord: boolean, provider: any): void; + /** + * Sets the maximum and minimum pinch-to-zoom level. + */ + setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; /** * Changes the zoom factor to the specified factor. Zoom factor is zoom percent * divided by 100, so 300% = 3.0. @@ -3122,7 +3144,8 @@ declare namespace Electron { */ setZoomLevel(level: number): void; /** - * Sets the maximum and minimum zoom level. + * Deprecated: Call setVisualZoomLevelLimits instead to set the visual zoom level + * limits. This method will be removed in Electron 2.0. */ setZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; } @@ -3181,23 +3204,23 @@ declare namespace Electron { /** * The app's name. */ - applicationName?: string; + applicationName: string; /** * The app's version. */ - applicationVersion?: string; + applicationVersion: string; /** * Copyright information. */ - copyright?: string; + copyright: string; /** * Credit information. */ - credits?: string; + credits: string; /** * The app's build version number. */ - version?: string; + version: string; } interface AuthInfo { @@ -3218,12 +3241,12 @@ declare namespace Electron { */ height: number; /** - * ( if y is used) - Window's left offset from screen. Default is to center the + * ( if y is used) Window's left offset from screen. Default is to center the * window. */ x?: number; /** - * ( if x is used) - Window's top offset from screen. Default is to center the + * ( if x is used) Window's top offset from screen. Default is to center the * window. */ y?: number; @@ -3309,7 +3332,7 @@ declare namespace Electron { * The window icon. On Windows it is recommended to use icons to get best visual * effects, you can also leave it undefined so the executable's icon will be used. */ - icon: NativeImage; + icon: NativeImage | string; /** * Whether window should be shown when created. Default is . */ @@ -3376,6 +3399,19 @@ declare namespace Electron { * Setting it to will remove window shadow and window animations. Default is . */ thickFrame: boolean; + /** + * Add a type of vibrancy effect to the window, only on macOS. Can be , , , , , , , + * , or . + */ + vibrancy: string; + /** + * Controls the behavior on macOS when option-clicking the green stoplight button + * on the toolbar or by clicking the Window > Zoom menu item. If , the window will + * grow to the preferred width of the web page when zoomed, will cause it to zoom + * to the width of the screen. This will also affect the behavior when calling + * directly. Default is . + */ + zoomToPageWidth: boolean; /** * Settings of web page's features. */ @@ -3397,6 +3433,20 @@ declare namespace Electron { quotas: string[]; } + interface CommandLine { + /** + * Append a switch (with optional value) to Chromium's command line. Note: This + * will not affect process.argv, and is mainly used by developers to control some + * low-level Chromium behaviors. + */ + appendSwitch?: (the_switch: string, value: string) => void; + /** + * Append an argument to Chromium's command line. The argument will be quoted + * correctly. Note: This will not affect process.argv. + */ + appendArgument: (value: string) => void; + } + interface Config { /** * The URL associated with the PAC file. @@ -3500,7 +3550,7 @@ declare namespace Electron { /** * Defaults to . */ - productName?: string; + productName: string; /** * Send the crash report without user interaction. Default is . */ @@ -3578,6 +3628,47 @@ declare namespace Electron { content: string; } + interface Dock { + /** + * When critical is passed, the dock icon will bounce until either the application + * becomes active or the request is canceled. When informational is passed, the + * dock icon will bounce for one second. However, the request remains active until + * either the application becomes active or the request is canceled. Returns an ID + * representing the request. + */ + bounce: (type: 'critical' | 'informational') => void; + /** + * Cancel the bounce of id. + */ + cancelBounce: (id: number) => void; + /** + * Bounces the Downloads stack if the filePath is inside the Downloads folder. + */ + downloadFinished: (filePath: string) => void; + /** + * Sets the string to be displayed in the dock’s badging area. + */ + setBadge: (text: string) => void; + getBadge: () => string; + /** + * Hides the dock icon. + */ + hide: () => void; + /** + * Shows the dock icon. + */ + show: () => void; + isVisible: () => boolean; + /** + * Sets the application's dock menu. + */ + setMenu: (menu: Menu) => void; + /** + * Sets the image associated with this dock icon. + */ + setIcon: (image: NativeImage) => void; + } + interface ExtraSize { width: number; height: number; @@ -3588,27 +3679,27 @@ declare namespace Electron { * Retrieves cookies which are associated with . Empty implies retrieving cookies * of all urls. */ - url?: string; + url: string; /** * Filters cookies by name. */ - name?: string; + name: string; /** * Retrieves cookies whose domains match or are subdomains of */ - domain?: string; + domain: string; /** * Retrieves cookies whose path matches . */ - path?: string; + path: string; /** * Filters cookies by their Secure property. */ - secure?: boolean; + secure: boolean; /** * Filters out session or persistent cookies. */ - session?: boolean; + session: boolean; } interface FindInPageOptions { @@ -3713,11 +3804,6 @@ declare namespace Electron { removedItems: JumpListItem[]; } - interface LastCrashReport { - date: string; - ID: number; - } - interface LoadURLOptions { /** * A HTTP Referrer url. @@ -3731,6 +3817,10 @@ declare namespace Electron { * Extra headers separated by "\n" */ extraHeaders: string; + /** + * [] (optional) + */ + postData?: UploadRawData | UploadFile | UploadFileSystem | UploadBlob; } interface LoginItemSettings { @@ -3766,46 +3856,46 @@ declare namespace Electron { /** * Will be called with when the menu item is clicked. */ - click: (menuItem: MenuItem, browserWindow: BrowserWindow, event: Event) => void; + click?: (menuItem: MenuItem, browserWindow: BrowserWindow, event: Event) => void; /** * Define the action of the menu item, when specified the property will be ignored. */ - role: string; + role?: string; /** * Can be , , , or . */ - type: string; - label: string; - sublabel: string; - accelerator: Accelerator; - icon: NativeImage; + type?: string; + label?: string; + sublabel?: string; + accelerator?: Accelerator; + icon?: NativeImage | string; /** * If false, the menu item will be greyed out and unclickable. */ - enabled: boolean; + enabled?: boolean; /** * If false, the menu item will be entirely hidden. */ - visible: boolean; + visible?: boolean; /** * Should only be specified for or type menu items. */ - checked: boolean; + checked?: boolean; /** * Should be specified for type menu items. If is specified, the can be omitted. If * the value is not a then it will be automatically converted to one using . */ - submenu: Menu; + submenu?: MenuItemConstructorOptions[] | Menu; /** * Unique within a single menu. If defined then it can be used as a reference to * this item by the position attribute. */ - id: string; + id?: string; /** * This field allows fine-grained definition of the specific location within a * given menu. */ - position: string; + position?: string; } interface MessageBoxOptions { @@ -3818,7 +3908,7 @@ declare namespace Electron { * Array of texts for buttons. On Windows, an empty array will result in one button * labeled "OK". */ - buttons: string[]; + buttons?: string[]; /** * Index of the button in the buttons array which will be selected by default when * the message box opens. @@ -3865,7 +3955,7 @@ declare namespace Electron { /** * The server IP address that the request was actually sent to. */ - ip?: string; + ip: string; fromCache: boolean; responseHeaders: ResponseHeaders; } @@ -3944,11 +4034,11 @@ declare namespace Electron { * be used. */ buttonLabel: string; - filters: string[]; + filters: FileFilter[]; /** * Contains which features the dialog should use, can contain , , , and . */ - properties: string[]; + properties?: string[]; } interface OpenExternalOptions { @@ -4066,7 +4156,7 @@ declare namespace Electron { interface ProgressBarOptions { /** - * - Mode for the progress bar (, , , , or ) + * Mode for the progress bar. Can be , , , , or . */ mode: string; } @@ -4086,8 +4176,8 @@ declare namespace Electron { interface RedirectRequest { url: string; method: string; - session?: Session; - uploadData?: UploadData; + session: Session; + uploadData: UploadData; } interface RegisterBufferProtocolRequest { @@ -4143,7 +4233,7 @@ declare namespace Electron { interface RelaunchOptions { args?: string[]; - execPath?: string; + execPath: string; } interface Request { @@ -4152,13 +4242,9 @@ declare namespace Electron { referrer: URL; } - interface Require { - module: string; - } - interface ResizeOptions { - width?: number; - height?: number; + width: number; + height: number; /** * The desired quality of the resize image. Possible values are , or . The default * is . These values express a desired quality/speed tradeoff. They are translated @@ -4166,7 +4252,7 @@ declare namespace Electron { * the underlying platform. It is possible for all three methods to be mapped to * the same algorithm on a given platform. */ - quality?: string; + quality: string; } interface ResourceUsage { @@ -4178,12 +4264,12 @@ declare namespace Electron { } interface Response { - cancel?: boolean; + cancel: boolean; /** * The original request is prevented from being sent or completed and is instead * redirected to the given URL. */ - redirectURL?: string; + redirectURL: string; } interface Result { @@ -4210,7 +4296,7 @@ declare namespace Electron { * be used. */ buttonLabel: string; - filters: string[]; + filters: FileFilter[]; } interface Settings { @@ -4231,6 +4317,14 @@ declare namespace Electron { height: number; } + interface SizeOptions { + /** + * Normal size of the page. This can be used in combination with the attribute to + * manually resize the webview guest contents. + */ + normal: Normal; + } + interface SourcesOptions { /** * An array of Strings that lists the types of desktop sources to be captured, @@ -4241,7 +4335,7 @@ declare namespace Electron { * The suggested size that the media source thumbnail should be scaled to, defaults * to . */ - thumbnailSize?: ThumbnailSize; + thumbnailSize: ThumbnailSize; } interface StartMonitoringOptions { @@ -4347,6 +4441,11 @@ declare namespace Electron { canRotate: boolean; } + interface Normal { + width: number; + height: number; + } + interface Offset { /** * Set the x axis offset from top left corner @@ -4577,3 +4676,4 @@ declare module 'original-fs' { export = fs; } + From 5e253443b1e4e7c9ddd70068d66624046c1c066f Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Thu, 23 Mar 2017 13:35:39 -0700 Subject: [PATCH 308/328] update electron.d.ts --- npm/electron.d.ts | 1462 ++++++++++++++++++++++++++++----------------- 1 file changed, 916 insertions(+), 546 deletions(-) diff --git a/npm/electron.d.ts b/npm/electron.d.ts index 5ab2fc06afb6..fa01e38e868d 100644 --- a/npm/electron.d.ts +++ b/npm/electron.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Electron 1.4.8 +// Type definitions for Electron undefined // Project: http://electron.atom.io/ @@ -28,6 +28,9 @@ declare namespace Electron { preventDefault: Function; sender: WebContents; returnValue?: any; + ctrlkey?: boolean; + metaKey?: boolean; + shiftKey?: boolean; } @@ -37,27 +40,21 @@ declare namespace Electron { crashReporter: Electron.CrashReporter; nativeImage: typeof Electron.NativeImage; NativeImage: typeof Electron.NativeImage; - process: Electron.Process; - screen: Electron.Screen; shell: Electron.Shell; + screen: Electron.Screen; } interface MainInterface extends CommonInterface { app: Electron.App; autoUpdater: Electron.AutoUpdater; BrowserWindow: typeof Electron.BrowserWindow; - ClientRequest: typeof Electron.ClientRequest; contentTracing: Electron.ContentTracing; - Cookies: typeof Electron.Cookies; - Debugger: typeof Electron.Debugger; dialog: Electron.Dialog; - DownloadItem: typeof Electron.DownloadItem; - globalShortcut: Electron.GlobalShortcut; - IncomingMessage: typeof Electron.IncomingMessage; ipcMain: Electron.IpcMain; + globalShortcut: Electron.GlobalShortcut; Menu: typeof Electron.Menu; - MenuItem: typeof Electron.MenuItem; net: Electron.Net; + MenuItem: typeof Electron.MenuItem; powerMonitor: Electron.PowerMonitor; powerSaveBlocker: Electron.PowerSaveBlocker; protocol: Electron.Protocol; @@ -67,11 +64,10 @@ declare namespace Electron { Tray: typeof Electron.Tray; webContents: typeof Electron.WebContents; WebContents: typeof Electron.WebContents; - WebRequest: typeof Electron.WebRequest; + process: Electron.Process; } interface RendererInterface extends CommonInterface { - BrowserWindowProxy: typeof Electron.BrowserWindowProxy; desktopCapturer: Electron.DesktopCapturer; ipcRenderer: Electron.IpcRenderer; remote: Electron.Remote; @@ -79,40 +75,33 @@ declare namespace Electron { } interface AllElectron { + clipboard: Electron.Clipboard; + crashReporter: Electron.CrashReporter; + nativeImage: typeof Electron.NativeImage; + shell: Electron.Shell; app: Electron.App; autoUpdater: Electron.AutoUpdater; BrowserWindow: typeof Electron.BrowserWindow; - BrowserWindowProxy: typeof Electron.BrowserWindowProxy; - ClientRequest: typeof Electron.ClientRequest; - clipboard: Electron.Clipboard; contentTracing: Electron.ContentTracing; - Cookies: typeof Electron.Cookies; - crashReporter: Electron.CrashReporter; - Debugger: typeof Electron.Debugger; - desktopCapturer: Electron.DesktopCapturer; dialog: Electron.Dialog; - DownloadItem: typeof Electron.DownloadItem; - globalShortcut: Electron.GlobalShortcut; - IncomingMessage: typeof Electron.IncomingMessage; ipcMain: Electron.IpcMain; - ipcRenderer: Electron.IpcRenderer; + globalShortcut: Electron.GlobalShortcut; Menu: typeof Electron.Menu; - MenuItem: typeof Electron.MenuItem; - nativeImage: typeof Electron.NativeImage; net: Electron.Net; + MenuItem: typeof Electron.MenuItem; powerMonitor: Electron.PowerMonitor; powerSaveBlocker: Electron.PowerSaveBlocker; - process: Electron.Process; protocol: Electron.Protocol; - remote: Electron.Remote; screen: Electron.Screen; session: typeof Electron.Session; - shell: Electron.Shell; systemPreferences: Electron.SystemPreferences; Tray: typeof Electron.Tray; webContents: typeof Electron.WebContents; + process: Electron.Process; + desktopCapturer: Electron.DesktopCapturer; + ipcRenderer: Electron.IpcRenderer; + remote: Electron.Remote; webFrame: Electron.WebFrame; - WebRequest: typeof Electron.WebRequest; } interface App extends EventEmitter { @@ -131,8 +120,10 @@ declare namespace Electron { */ accessibilitySupportEnabled: boolean) => void): this; /** - * Emitted when the application is activated, which usually happens when the user - * clicks on the application's dock icon. + * Emitted when the application is activated. Various actions can trigger this + * event, such as launching the application for the first time, attempting to + * re-launch the application when it's already running, or clicking on the + * application's dock or taskbar icon. */ on(event: 'activate', listener: (event: Event, hasVisibleWindows: boolean) => void): this; @@ -166,13 +157,13 @@ declare namespace Electron { */ on(event: 'certificate-error', listener: (event: Event, webContents: WebContents, - url: URL, + url: string, /** * The error code */ error: string, certificate: Certificate, - callback: Function) => void): this; + callback: (isTrusted: boolean) => void) => void): this; /** * Emitted during Handoff when an activity from a different device wants to be * resumed. You should call event.preventDefault() if you want to handle this @@ -205,7 +196,7 @@ declare namespace Electron { webContents: WebContents, request: Request, authInfo: AuthInfo, - callback: Function) => void): this; + callback: (username: string, password: string) => void) => void): this; /** * Emitted when the user wants to open a file with the application. The open-file * event is usually emitted when the application is already open and the OS wants @@ -240,15 +231,15 @@ declare namespace Electron { on(event: 'ready', listener: (launchInfo: any) => void): this; /** * Emitted when a client certificate is requested. The url corresponds to the - * navigation entry requesting the client certificate and callback needs to be - * called with an entry filtered from the list. Using event.preventDefault() - * prevents the application from using the first certificate from the store. + * navigation entry requesting the client certificate and callback can be called + * with an entry filtered from the list. Using event.preventDefault() prevents the + * application from using the first certificate from the store. */ on(event: 'select-client-certificate', listener: (event: Event, webContents: WebContents, url: URL, certificateList: Certificate[], - callback: Function) => void): this; + callback: (certificate?: Certificate) => void) => void): this; /** * Emitted when a new webContents is created. */ @@ -299,7 +290,7 @@ declare namespace Electron { * closed immediately without asking user and the before-quit and will-quit events * will not be emitted. */ - exit(exitCode: number): void; + exit(exitCode?: number): void; /** * On Linux, focuses on the first visible window. On macOS, makes the application * the active app. On Windows, focuses on the application's first window. @@ -308,6 +299,16 @@ declare namespace Electron { getAppPath(): string; getBadgeCount(): number; getCurrentActivityType(): string; + /** + * Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux + * and macOS, icons depend on the application associated with file mime type. + */ + getFileIcon(path: string, callback: (error: Error, icon: NativeImage) => void): void; + /** + * Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux + * and macOS, icons depend on the application associated with file mime type. + */ + getFileIcon(path: string, options: FileIconOptions, callback: (error: Error, icon: NativeImage) => void): void; getJumpListSettings(): JumpListSettings; /** * Note: When distributing your packaged app, you have to also ship the locales @@ -316,9 +317,11 @@ declare namespace Electron { */ getLocale(): string; /** - * Note: This API has no effect on MAS builds. + * If you provided path and args options to app.setLoginItemSettings then you need + * to pass the same arguments here for openAtLogin to be set correctly. Note: This + * API has no effect on MAS builds. */ - getLoginItemSettings(): LoginItemSettings; + getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings; /** * Usually the name field of package.json is a short lowercased name, according to * the npm modules spec. You should usually also specify a productName field, which @@ -352,7 +355,7 @@ declare namespace Electron { * macOS machine. Please refer to Apple's documentation for details. The API uses * the Windows Registry and LSCopyDefaultHandlerForURLScheme internally. */ - isDefaultProtocolClient(protocol: string, path: string, args?: string[]): boolean; + isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; isReady(): boolean; isUnityRunning(): boolean; /** @@ -396,7 +399,7 @@ declare namespace Electron { * restarting current instance immediately and adding a new command line argument * to the new instance: */ - relaunch(options: RelaunchOptions): void; + relaunch(options?: RelaunchOptions): void; /** * Releases all locks that were created by makeSingleInstance. This will allow * multiple instances of the application to once again run side by side. @@ -406,7 +409,7 @@ declare namespace Electron { * This method checks if the current executable as the default handler for a * protocol (aka URI scheme). If so, it will remove the app as the default handler. */ - removeAsDefaultProtocolClient(protocol: string, path: string, args?: string[]): boolean; + removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; /** * Set the about panel options. This will override the values defined in the app's * .plist file. See the Apple docs for more details. @@ -430,11 +433,11 @@ declare namespace Electron { * The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme * internally. */ - setAsDefaultProtocolClient(protocol: string, path: string, args?: string[]): boolean; + setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; /** * Sets the counter badge for current app. Setting the count to 0 will hide the * badge. On macOS it shows on the dock icon. On Linux it only works for Unity - * launcher, Note: Unity launcher requires the exsistence of a .desktop file to + * launcher, Note: Unity launcher requires the existence of a .desktop file to * work, for more information please read Desktop Environment Integration. */ setBadgeCount(count: number): boolean; @@ -455,9 +458,12 @@ declare namespace Electron { */ setJumpList(categories: JumpListCategory[]): void; /** - * Set the app's login item settings. Note: This API has no effect on MAS builds. + * Set the app's login item settings. To work with Electron's autoUpdater on + * Windows, which uses Squirrel, you'll want to set the launch path to Update.exe, + * and pass arguments that specify your application name. For example: Note: This + * API has no effect on MAS builds. */ - setLoginItemSettings(settings: Settings): void; + setLoginItemSettings(settings: Settings, path?: string, args?: string[]): void; /** * Overrides the current application's name. */ @@ -476,7 +482,7 @@ declare namespace Electron { * Creates an NSUserActivity and sets it as the current activity. The activity is * eligible for Handoff to another device afterward. */ - setUserActivity(type: string, userInfo: any, webpageURL: string): void; + setUserActivity(type: string, userInfo: any, webpageURL?: string): void; /** * Adds tasks to the Tasks category of the JumpList on Windows. tasks is an array * of Task objects. Note: If you'd like to customize the Jump List even more use @@ -539,7 +545,7 @@ declare namespace Electron { /** * Sets the url and initialize the auto updater. */ - setFeedURL(url: string, requestHeaders: any): void; + setFeedURL(url: string, requestHeaders?: any): void; } type BluetoothDevice = { @@ -629,8 +635,8 @@ declare namespace Electron { on(event: 'page-title-updated', listener: (event: Event, title: string) => void): this; /** - * Emitted when the web page has been rendered and window can be displayed without - * a visual flash. + * Emitted when the web page has been rendered (while not being shown) and window + * can be displayed without a visual flash. */ on(event: 'ready-to-show', listener: Function): this; /** @@ -674,7 +680,7 @@ declare namespace Electron { * Emitted when the web page becomes unresponsive. */ on(event: 'unresponsive', listener: Function): this; - constructor(options: BrowserWindowConstructorOptions); + constructor(options?: BrowserWindowConstructorOptions); /** * Adds DevTools extension located at path, and returns extension's name. The * extension will be remembered so you only need to call this API once, this API is @@ -704,6 +710,10 @@ declare namespace Electron { */ blur(): void; blurWebView(): void; + /** + * Same as webContents.capturePage([rect, ]callback). + */ + capturePage(callback: (image: NativeImage) => void): void; /** * Same as webContents.capturePage([rect, ]callback). */ @@ -718,6 +728,10 @@ declare namespace Electron { * the close event. */ close(): void; + /** + * Closes the currently open Quick Look panel. + */ + closeFilePreview(): void; /** * Force closing the window, the unload and beforeunload event won't be emitted for * the web page, and close event will also not be emitted for this window, but it @@ -805,11 +819,13 @@ declare namespace Electron { * Same as webContents.loadURL(url[, options]). The url can be a remote address * (e.g. http://) or a path to a local HTML file using the file:// protocol. To * ensure that file URLs are properly formatted, it is recommended to use Node's - * url.format method: + * url.format method: You can load a URL using a POST request with URL-encoded data + * by doing the following: */ - loadURL(url: string, options: LoadURLOptions): void; + loadURL(url: string, options?: LoadURLOptions): void; /** - * Maximizes the window. + * Maximizes the window. This will also show (but not focus) the window if it isn't + * being displayed already. */ maximize(): void; /** @@ -820,7 +836,7 @@ declare namespace Electron { /** * Uses Quick Look to preview a file at a given path. */ - previewFile(path: string, displayName: string): void; + previewFile(path: string, displayName?: string): void; /** * Same as webContents.reload. */ @@ -834,7 +850,13 @@ declare namespace Electron { * setting this, the window is still a normal window, not a toolbox window which * can not be focused on. */ - setAlwaysOnTop(flag: boolean, level: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver'): void; + setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void; + /** + * Sets the properties for the window's taskbar button. Note: relaunchCommand and + * relaunchDisplayName must always be set together. If one of those properties is + * not set, then neither will be used. + */ + setAppDetails(options: AppDetailsOptions): void; /** * This will make a window maintain an aspect ratio. The extra size allows a * developer to have space, specified in pixels, not included within the aspect @@ -849,7 +871,11 @@ declare namespace Electron { * Just sum any extra width and height areas you have within the overall content * view. */ - setAspectRatio(aspectRatio: number, extraSize: ExtraSize): void; + setAspectRatio(aspectRatio: number, extraSize?: ExtraSize): void; + /** + * Controls whether to hide cursor when typing. + */ + setAutoHideCursor(autoHide: boolean): void; /** * Sets whether the window menu bar should hide itself automatically. Once set the * menu bar will only show when users press the single Alt key. If the menu bar is @@ -859,7 +885,7 @@ declare namespace Electron { /** * Resizes and moves the window to the supplied bounds */ - setBounds(bounds: Rectangle, animate: boolean): void; + setBounds(bounds: Rectangle, animate?: boolean): void; /** * Sets whether the window can be manually closed by user. On Linux does nothing. */ @@ -868,7 +894,7 @@ declare namespace Electron { * Resizes and moves the window's client area (e.g. the web page) to the supplied * bounds. */ - setContentBounds(bounds: Rectangle, animate: boolean): void; + setContentBounds(bounds: Rectangle, animate?: boolean): void; /** * Prevents the window contents from being captured by other apps. On macOS it sets * the NSWindow's sharingType to NSWindowSharingNone. On Windows it calls @@ -878,7 +904,7 @@ declare namespace Electron { /** * Resizes the window's client area (e.g. the web page) to width and height. */ - setContentSize(width: number, height: number, animate: boolean): void; + setContentSize(width: number, height: number, animate?: boolean): void; /** * Specifies whether the window’s document has been edited, and the icon in title * bar will become gray when set to true. @@ -960,7 +986,7 @@ declare namespace Electron { /** * Moves window to x and y. */ - setPosition(x: number, y: number, animate: boolean): void; + setPosition(x: number, y: number, animate?: boolean): void; /** * Sets progress value in progress bar. Valid range is [0, 1.0]. Remove progress * bar when progress < 0; Change to indeterminate mode when progress > 1. On Linux @@ -971,7 +997,7 @@ declare namespace Electron { * without a mode set (but with a value within the valid range), normal will be * assumed. */ - setProgressBar(progress: number, options: ProgressBarOptions): void; + setProgressBar(progress: number, options?: ProgressBarOptions): void; /** * Sets the pathname of the file the window represents, and the icon of the file * will show in window's title bar. @@ -986,11 +1012,11 @@ declare namespace Electron { * attached just below the window frame, but you may want to display them beneath a * HTML-rendered toolbar. For example: */ - setSheetOffset(offsetY: number, offsetX: number): void; + setSheetOffset(offsetY: number, offsetX?: number): void; /** * Resizes the window to width and height. */ - setSize(width: number, height: number, animate: boolean): void; + setSize(width: number, height: number, animate?: boolean): void; /** * Makes the window not show in the taskbar. */ @@ -1021,6 +1047,13 @@ declare namespace Electron { * Changes the title of native window to title. */ setTitle(title: string): void; + /** + * Sets the touchBar layout for the current window. Specifying null or undefined + * clears the touch bar. This method only has an effect if the machine has a touch + * bar and is running on macOS 10.12.1+. Note: The TouchBar API is currently + * experimental and may change or be removed in future Electron releases. + */ + setTouchBar(touchBar: TouchBar): void; /** * Adds a vibrancy effect to the browser window. Passing null or an empty string * will remove the vibrancy effect on the window. @@ -1108,18 +1141,6 @@ declare namespace Electron { validStart: number; } - type CertificatePrincipal = { - - // Docs: http://electron.atom.io/docs/api/structures/certificate-principal - - commonName: string; - country: string; - locality: string; - organizations: string[]; - organizationUnits: string[]; - state: string; - } - class ClientRequest extends EventEmitter { // Docs: http://electron.atom.io/docs/api/client-request @@ -1156,7 +1177,7 @@ declare namespace Electron { * the response object: */ on(event: 'login', listener: (authInfo: AuthInfo, - callback: Function) => void): this; + callback: () => void) => void): this; on(event: 'response', listener: (/** * An object representing the HTTP response message. */ @@ -1173,7 +1194,7 @@ declare namespace Electron { * Sends the last chunk of the request data. Subsequent write or end operations * will not be allowed. The finish event is emitted just after the end operation. */ - end(chunk: string | Buffer, encoding: string, callback: Function): void; + end(chunk?: string | Buffer, encoding?: string, callback?: Function): void; /** * Returns String - The value of a previously set extra header name. */ @@ -1199,7 +1220,7 @@ declare namespace Electron { * issued on the wire. After the first write operation, it is not allowed to add or * remove a custom header. */ - write(chunk: string | Buffer, encoding: string, callback: Function): void; + write(chunk: string | Buffer, encoding?: string, callback?: Function): void; chunkedEncoding: boolean; } @@ -1207,34 +1228,35 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/clipboard - availableFormats(type: string): string[]; + availableFormats(type?: string): string[]; /** * Clears the clipboard content. */ - clear(type: string): void; - has(data: string, type: string): boolean; - read(data: string, type: string): string; + clear(type?: string): void; + has(format: string, type?: string): boolean; + read(format: string): string; /** * Returns an Object containing title and url keys representing the bookmark in the * clipboard. The title and url values will be empty strings when the bookmark is * unavailable. */ readBookmark(): ReadBookmark; + readBuffer(format: string): Buffer; readFindText(): string; - readHTML(type: string): string; - readImage(type: string): NativeImage; - readRTF(type: string): string; - readText(type: string): string; + readHTML(type?: string): string; + readImage(type?: string): NativeImage; + readRTF(type?: string): string; + readText(type?: string): string; /** * Writes data to the clipboard. */ - write(data: Data, type: string): void; + write(data: Data, type?: string): void; /** * Writes the title and url into the clipboard as a bookmark. Note: Most apps on * Windows don't support pasting bookmarks into them so you can use clipboard.write * to write both a bookmark and fallback text to the clipboard. */ - writeBookmark(title: string, url: string, type: string): void; + writeBookmark(title: string, url: string, type?: string): void; /** * Writes the text into the find pasteboard as plain text. This method uses * synchronous IPC when called from the renderer process. @@ -1243,30 +1265,25 @@ declare namespace Electron { /** * Writes markup to the clipboard. */ - writeHTML(markup: string, type: string): void; + writeHTML(markup: string, type?: string): void; /** * Writes image to the clipboard. */ - writeImage(image: NativeImage, type: string): void; + writeImage(image: NativeImage, type?: string): void; /** * Writes the text into the clipboard in RTF. */ - writeRTF(text: string, type: string): void; + writeRTF(text: string, type?: string): void; /** * Writes the text into the clipboard as plain text. */ - writeText(text: string, type: string): void; + writeText(text: string, type?: string): void; } interface ContentTracing extends EventEmitter { // Docs: http://electron.atom.io/docs/api/content-tracing - /** - * Cancel the watch event. This may lead to a race condition with the watch event - * callback if tracing is enabled. - */ - cancelWatchEvent(): void; /** * Get the current monitoring traced data. Child processes typically cache trace * data and only rarely flush and send trace data back to the main process. This is @@ -1289,10 +1306,6 @@ declare namespace Electron { * called. */ getTraceBufferUsage(callback: (value: number, percentage: number) => void): void; - /** - * callback will be called every time the given event occurs on any process. - */ - setWatchEvent(categoryName: string, eventName: string, callback: Function): void; /** * Start monitoring on all processes. Monitoring begins immediately locally and * asynchronously on child processes as soon as they receive the startMonitoring @@ -1309,7 +1322,7 @@ declare namespace Electron { * category groups that contain a matching category. Having both included and * excluded category patterns in the same list is not supported. Examples: * traceOptions controls what kind of tracing is enabled, it is a comma-delimited - * list. Possible options are: The first 3 options are trace recoding modes and + * list. Possible options are: The first 3 options are trace recording modes and * hence mutually exclusive. If more than one trace recording modes appear in the * traceOptions string, the last one takes precedence. If none of the trace * recording modes are specified, recording mode is record-until-full. The trace @@ -1341,14 +1354,14 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/structures/cookie - domain: string; - expirationDate: number; - hostOnly: string; - httpOnly: boolean; + domain?: string; + expirationDate?: number; + hostOnly?: boolean; + httpOnly?: boolean; name: string; - path: string; - secure: boolean; - session: boolean; + path?: string; + secure?: boolean; + session?: boolean; value: string; } @@ -1414,12 +1427,46 @@ declare namespace Electron { */ getUploadedReports(): CrashReport[]; /** - * You are required to call this method before using other crashReporter APIs. - * Note: On macOS, Electron uses a new crashpad client, which is different from - * breakpad on Windows and Linux. To enable the crash collection feature, you are - * required to call the crashReporter.start API to initialize crashpad in the main - * process and in each renderer process from which you wish to collect crash - * reports. + * Note: This API can only be called from the main process. + */ + getUploadToServer(): boolean; + /** + * Set an extra parameter to set be sent with the crash report. The values + * specified here will be sent in addition to any values set via the extra option + * when start was called. This API is only available on macOS, if you need to + * add/update extra parameters on Linux and Windows after your first call to start + * you can call start again with the updated extra options. + */ + setExtraParameter(key: string, value: string): void; + /** + * This would normally be controlled by user preferences. This has no effect if + * called before start is called. Note: This API can only be called from the main + * process. + */ + setUploadToServer(uploadToServer: boolean): void; + /** + * You are required to call this method before using any other crashReporter APIs + * and in each process (main/renderer) from which you want to collect crash + * reports. You can pass different options to crashReporter.start when calling from + * different processes. Note Child processes created via the child_process module + * will not have access to the Electron modules. Therefore, to collect crash + * reports from them, use process.crashReporter.start instead. Pass the same + * options as above along with an additional one called crashesDirectory that + * should point to a directory to store the crash reports temporarily. You can test + * this out by calling process.crash() to crash the child process. Note: To collect + * crash reports from child process in Windows, you need to add this extra code as + * well. This will start the process that will monitor and send the crash reports. + * Replace submitURL, productName and crashesDirectory with appropriate values. + * Note: If you need send additional/updated extra parameters after your first call + * start you can call setExtraParameter on macOS or call start again with the + * new/updated extra parameters on Linux and Windows. Note: On macOS, Electron uses + * a new crashpad client for crash collection and reporting. If you want to enable + * crash reporting, initializing crashpad from the main process using + * crashReporter.start is required regardless of which process you want to collect + * crashes from. Once initialized this way, the crashpad handler collects crashes + * from all processes. You still have to call crashReporter.start from the renderer + * or child process, otherwise crashes from them will get reported without + * companyName, productName or any of the extra information. */ start(options: CrashReporterStartOptions): void; } @@ -1453,7 +1500,7 @@ declare namespace Electron { /** * Attaches the debugger to the webContents. */ - attach(protocolVersion: string): void; + attach(protocolVersion?: string): void; /** * Detaches the debugger from the webContents. */ @@ -1462,7 +1509,7 @@ declare namespace Electron { /** * Send given command to the debugging target. */ - sendCommand(method: string, commandParams: any, callback: (error: any, result: any) => void): void; + sendCommand(method: string, commandParams?: any, callback?: (error: any, result: any) => void): void; } interface DesktopCapturer extends EventEmitter { @@ -1500,28 +1547,62 @@ declare namespace Electron { showErrorBox(title: string, content: string): void; /** * Shows a message box, it will block the process until the message box is closed. - * It returns the index of the clicked button. If a callback is passed, the API - * call will be asynchronous and the result will be passed via callback(response). + * It returns the index of the clicked button. The browserWindow argument allows + * the dialog to attach itself to a parent window, making it modal. If a callback + * is passed, the API call will be asynchronous and the result will be passed via + * callback(response). */ - showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions, callback: (response: number) => void): number; + showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions, callback?: (response: number, checkboxChecked: boolean) => void): number; /** - * The filters specifies an array of file types that can be displayed or selected - * when you want to limit the user to a specific type. For example: The extensions - * array should contain extensions without wildcards or dots (e.g. 'png' is good - * but '.png' and '*.png' are bad). To show all files, use the '*' wildcard (no - * other wildcard is supported). If a callback is passed, the API call will be - * asynchronous and the result will be passed via callback(filenames) Note: On - * Windows and Linux an open dialog can not be both a file selector and a directory - * selector, so if you set properties to ['openFile', 'openDirectory'] on these - * platforms, a directory selector will be shown. + * Shows a message box, it will block the process until the message box is closed. + * It returns the index of the clicked button. The browserWindow argument allows + * the dialog to attach itself to a parent window, making it modal. If a callback + * is passed, the API call will be asynchronous and the result will be passed via + * callback(response). */ - showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions, callback: (filePaths: string[]) => void): string[]; + showMessageBox(options: MessageBoxOptions, callback?: (response: number, checkboxChecked: boolean) => void): number; /** - * The filters specifies an array of file types that can be displayed, see - * dialog.showOpenDialog for an example. If a callback is passed, the API call will - * be asynchronous and the result will be passed via callback(filename) + * The browserWindow argument allows the dialog to attach itself to a parent + * window, making it modal. The filters specifies an array of file types that can + * be displayed or selected when you want to limit the user to a specific type. For + * example: The extensions array should contain extensions without wildcards or + * dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use + * the '*' wildcard (no other wildcard is supported). If a callback is passed, the + * API call will be asynchronous and the result will be passed via + * callback(filenames) Note: On Windows and Linux an open dialog can not be both a + * file selector and a directory selector, so if you set properties to ['openFile', + * 'openDirectory'] on these platforms, a directory selector will be shown. */ - showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions, callback: (filename: string) => void): string; + showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions, callback?: (filePaths: string[]) => void): string[]; + /** + * The browserWindow argument allows the dialog to attach itself to a parent + * window, making it modal. The filters specifies an array of file types that can + * be displayed or selected when you want to limit the user to a specific type. For + * example: The extensions array should contain extensions without wildcards or + * dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use + * the '*' wildcard (no other wildcard is supported). If a callback is passed, the + * API call will be asynchronous and the result will be passed via + * callback(filenames) Note: On Windows and Linux an open dialog can not be both a + * file selector and a directory selector, so if you set properties to ['openFile', + * 'openDirectory'] on these platforms, a directory selector will be shown. + */ + showOpenDialog(options: OpenDialogOptions, callback?: (filePaths: string[]) => void): string[]; + /** + * The browserWindow argument allows the dialog to attach itself to a parent + * window, making it modal. The filters specifies an array of file types that can + * be displayed, see dialog.showOpenDialog for an example. If a callback is passed, + * the API call will be asynchronous and the result will be passed via + * callback(filename) + */ + showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions, callback?: (filename: string) => void): string; + /** + * The browserWindow argument allows the dialog to attach itself to a parent + * window, making it modal. The filters specifies an array of file types that can + * be displayed, see dialog.showOpenDialog for an example. If a callback is passed, + * the API call will be asynchronous and the result will be passed via + * callback(filename) + */ + showSaveDialog(options: SaveDialogOptions, callback?: (filename: string) => void): string; } type Display = { @@ -1564,21 +1645,29 @@ declare namespace Electron { */ canResume(): void; getContentDisposition(): string; + getETag(): string; /** * Note: The file name is not always the same as the actual one saved in local * disk. If user changes the file name in a prompted download saving dialog, the * actual name of saved file will be different. */ getFilename(): string; + getLastModifiedTime(): string; getMimeType(): string; getReceivedBytes(): number; getSavePath(): string; + getStartTime(): number; + /** + * Note: The following methods are useful specifically to resume a cancelled item + * when session is restarted. + */ getState(): string; /** * If the size is unknown, it returns 0. */ getTotalBytes(): number; getURL(): string; + getURLChain(): string[]; hasUserGesture(): boolean; isPaused(): boolean; /** @@ -1663,6 +1752,8 @@ declare namespace Electron { on(event: 'error', listener: Function): this; headers: any; httpVersion: string; + httpVersionMajor: number; + httpVersionMinor: number; statusCode: number; statusMessage: string; } @@ -1684,7 +1775,7 @@ declare namespace Electron { /** * Removes all listeners, or those of the specified channel. */ - removeAllListeners(channel: string): this; + removeAllListeners(channel?: string): this; /** * Removes the specified listener from the listener array for the specified * channel. @@ -1709,7 +1800,7 @@ declare namespace Electron { /** * Removes all listeners, or those of the specified channel. */ - removeAllListeners(channel: string): this; + removeAllListeners(channel?: string): this; /** * Removes the specified listener from the listener array for the specified * channel. @@ -1744,7 +1835,7 @@ declare namespace Electron { items?: JumpListItem[]; name?: string; - type: string; + type?: string; } type JumpListItem = { @@ -1753,12 +1844,12 @@ declare namespace Electron { args?: string; description?: string; - iconIndex: number; - iconPath: string; + iconIndex?: number; + iconPath?: string; path?: string; program?: string; title?: string; - type: string; + type?: string; } type MemoryUsageDetails = { @@ -1766,10 +1857,7 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/structures/memory-usage-details count: number; - decodedSize: number; liveSize: number; - purgeableSize: number; - purgedSize: number; size: number; } @@ -1803,6 +1891,10 @@ declare namespace Electron { * Appends the menuItem to the menu. */ append(menuItem: MenuItem): void; + /** + * Closes the context menu in the browserWindow. + */ + closePopup(browserWindow?: BrowserWindow): void; /** * Inserts the menuItem to the pos position of the menu. */ @@ -1810,11 +1902,7 @@ declare namespace Electron { /** * Pops up this menu as a context menu in the browserWindow. */ - popup(browserWindow: BrowserWindow, x: number, y?: number, positioningItem: number): void; - /** - * Pops up this menu as a context menu in the browserWindow. - */ - popup(browserWindow: BrowserWindow, x: number, positioningItem: number): void; + popup(browserWindow?: BrowserWindow, options?: PopupOptions): void; items: MenuItem[]; } @@ -1824,7 +1912,9 @@ declare namespace Electron { constructor(options: MenuItemConstructorOptions); checked: boolean; + click: Function; enabled: boolean; + label: string; visible: boolean; } @@ -1837,9 +1927,9 @@ declare namespace Electron { */ static createEmpty(): NativeImage; /** - * Creates a new NativeImage instance from buffer. The default scaleFactor is 1.0. + * Creates a new NativeImage instance from buffer. */ - static createFromBuffer(buffer: Buffer, scaleFactor: number): NativeImage; + static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage; /** * Creates a new NativeImage instance from dataURL. */ @@ -1850,6 +1940,12 @@ declare namespace Electron { * valid image. */ static createFromPath(path: string): NativeImage; + /** + * Add an image representation for a specific scale factor. This can be used to + * explicitly add different scale factor representations to an image. This can be + * called on empty images. + */ + addRepresentation(options: AddRepresentationOptions): void; crop(rect: Rect): NativeImage; getAspectRatio(): number; /** @@ -1857,7 +1953,7 @@ declare namespace Electron { * the bitmap data, so you have to use the returned Buffer immediately in current * event loop tick, otherwise the data might be changed or destroyed. */ - getBitmap(): Buffer; + getBitmap(options?: BitmapOptions): Buffer; /** * Notice that the returned pointer is a weak pointer to the underlying native * image instead of a copy, so you must ensure that the associated nativeImage @@ -1876,10 +1972,10 @@ declare namespace Electron { * Marks the image as a template image. */ setTemplateImage(option: boolean): void; - toBitmap(): Buffer; - toDataURL(): string; + toBitmap(options?: ToBitmapOptions): Buffer; + toDataURL(options?: ToDataURLOptions): string; toJPEG(quality: number): Buffer; - toPNG(): Buffer; + toPNG(options?: ToPNGOptions): Buffer; } interface Net extends EventEmitter { @@ -1991,22 +2087,22 @@ declare namespace Electron { * Intercepts scheme protocol and uses handler as the protocol's new handler which * sends a Buffer as a response. */ - interceptBufferProtocol(scheme: string, handler: (request: InterceptBufferProtocolRequest, callback: (buffer: Buffer) => void) => void, completion: (error: Error) => void): void; + interceptBufferProtocol(scheme: string, handler: (request: InterceptBufferProtocolRequest, callback: (buffer?: Buffer) => void) => void, completion?: (error: Error) => void): void; /** * Intercepts scheme protocol and uses handler as the protocol's new handler which * sends a file as a response. */ - interceptFileProtocol(scheme: string, handler: (request: InterceptFileProtocolRequest, callback: (filePath: string) => void) => void, completion: (error: Error) => void): void; + interceptFileProtocol(scheme: string, handler: (request: InterceptFileProtocolRequest, callback: (filePath: string) => void) => void, completion?: (error: Error) => void): void; /** * Intercepts scheme protocol and uses handler as the protocol's new handler which * sends a new HTTP request as a response. */ - interceptHttpProtocol(scheme: string, handler: (request: InterceptHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion: (error: Error) => void): void; + interceptHttpProtocol(scheme: string, handler: (request: InterceptHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void; /** * Intercepts scheme protocol and uses handler as the protocol's new handler which * sends a String as a response. */ - interceptStringProtocol(scheme: string, handler: (request: InterceptStringProtocolRequest, callback: (data: string) => void) => void, completion: (error: Error) => void): void; + interceptStringProtocol(scheme: string, handler: (request: InterceptStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void; /** * The callback will be called with a boolean that indicates whether there is * already a handler for scheme. @@ -2018,7 +2114,7 @@ declare namespace Electron { * with either a Buffer object or an object that has the data, mimeType, and * charset properties. Example: */ - registerBufferProtocol(scheme: string, handler: (request: RegisterBufferProtocolRequest, callback: (buffer: Buffer) => void) => void, completion: (error: Error) => void): void; + registerBufferProtocol(scheme: string, handler: (request: RegisterBufferProtocolRequest, callback: (buffer?: Buffer | MimeTypedBuffer) => void) => void, completion?: (error: Error) => void): void; /** * Registers a protocol of scheme that will send the file as a response. The * handler will be called with handler(request, callback) when a request is going @@ -2034,7 +2130,7 @@ declare namespace Electron { * want to call protocol.registerStandardSchemes to have your scheme treated as a * standard scheme. */ - registerFileProtocol(scheme: string, handler: (request: RegisterFileProtocolRequest, callback: (filePath: string) => void) => void, completion: (error: Error) => void): void; + registerFileProtocol(scheme: string, handler: (request: RegisterFileProtocolRequest, callback: (filePath?: string) => void) => void, completion?: (error: Error) => void): void; /** * Registers a protocol of scheme that will send an HTTP request as a response. The * usage is the same with registerFileProtocol, except that the callback should be @@ -2043,7 +2139,7 @@ declare namespace Electron { * current session. If you want the request to have a different session you should * set session to null. For POST requests the uploadData object must be provided. */ - registerHttpProtocol(scheme: string, handler: (request: RegisterHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion: (error: Error) => void): void; + registerHttpProtocol(scheme: string, handler: (request: RegisterHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void; registerServiceWorkerSchemes(schemes: string[]): void; /** * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example @@ -2061,22 +2157,22 @@ declare namespace Electron { * to register it as a standard scheme: Note: This method can only be used before * the ready event of the app module gets emitted. */ - registerStandardSchemes(schemes: string[]): void; + registerStandardSchemes(schemes: string[], options?: RegisterStandardSchemesOptions): void; /** * Registers a protocol of scheme that will send a String as a response. The usage * is the same with registerFileProtocol, except that the callback should be called * with either a String or an object that has the data, mimeType, and charset * properties. */ - registerStringProtocol(scheme: string, handler: (request: RegisterStringProtocolRequest, callback: (data: string) => void) => void, completion: (error: Error) => void): void; + registerStringProtocol(scheme: string, handler: (request: RegisterStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void; /** * Remove the interceptor installed for scheme and restore its original handler. */ - uninterceptProtocol(scheme: string, completion: (error: Error) => void): void; + uninterceptProtocol(scheme: string, completion?: (error: Error) => void): void; /** * Unregisters the custom protocol of scheme. */ - unregisterProtocol(scheme: string, completion: (error: Error) => void): void; + unregisterProtocol(scheme: string, completion?: (error: Error) => void): void; } type Rectangle = { @@ -2154,22 +2250,78 @@ declare namespace Electron { on(event: 'will-download', listener: (event: Event, item: DownloadItem, webContents: WebContents) => void): this; + /** + * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate + * authentication. + */ + allowNTLMCredentialsForDomains(domains: string): void; + /** + * Clears the session’s HTTP authentication cache. + */ + clearAuthCache(options: RemovePassword | RemoveClientCertificate, callback?: Function): void; /** * Clears the session’s HTTP cache. */ clearCache(callback: Function): void; + /** + * Clears the host resolver cache. + */ + clearHostResolverCache(callback?: Function): void; /** * Clears the data of web storages. */ - clearStorageData(options: ClearStorageDataOptions, callback: Function): void; + clearStorageData(options?: ClearStorageDataOptions, callback?: Function): void; + /** + * Allows resuming cancelled or interrupted downloads from previous Session. The + * API will generate a DownloadItem that can be accessed with the will-download + * event. The DownloadItem will not have any WebContents associated with it and the + * initial state will be interrupted. The download will start only when the resume + * API is called on the DownloadItem. + */ + createInterruptedDownload(options: CreateInterruptedDownloadOptions): void; + /** + * Disables any network emulation already active for the session. Resets to the + * original network configuration. + */ + disableNetworkEmulation(): void; + /** + * Emulates network with the given configuration for the session. + */ + enableNetworkEmulation(options: EnableNetworkEmulationOptions): void; /** * Writes any unwritten DOMStorage data to disk. */ flushStorageData(): void; + getBlobData(identifier: string, callback: (result: Buffer) => void): Blob; /** - * Returns the session's current cache size. + * Callback is invoked with the session's current cache size. */ getCacheSize(callback: (size: number) => void): void; + getUserAgent(): string; + /** + * Resolves the proxy information for url. The callback will be called with + * callback(proxy) when the request is performed. + */ + resolveProxy(url: URL, callback: (proxy: string) => void): void; + /** + * Sets the certificate verify proc for session, the proc will be called with + * proc(request, callback) whenever a server certificate verification is requested. + * Calling callback(0) accepts the certificate, calling callback(-2) rejects it. + * Calling setCertificateVerifyProc(null) will revert back to default certificate + * verify proc. + */ + setCertificateVerifyProc(proc: (request: CertificateVerifyProcRequest, callback: (verificationResult: number) => void) => void): void; + /** + * Sets download saving directory. By default, the download directory will be the + * Downloads under the respective app folder. + */ + setDownloadPath(path: string): void; + /** + * Sets the handler which can be used to respond to permission requests for the + * session. Calling callback(true) will allow the permission and callback(false) + * will reject it. + */ + setPermissionRequestHandler(handler: (webContents: any, permission: string, callback: (permissionGranted: boolean) => void) => void): void; /** * Sets the proxy settings. When pacScript and proxyRules are provided together, * the proxyRules option is ignored and pacScript configuration is applied. The @@ -2177,6 +2329,14 @@ declare namespace Electron { * comma separated list of rules described below: */ setProxy(config: Config, callback: Function): void; + /** + * Overrides the userAgent and acceptLanguages for this session. The + * acceptLanguages must a comma separated ordered list of language codes, for + * example "en-US,fr,de,ko,zh-CN,ja". This doesn't affect existing WebContents, and + * each WebContents can use webContents.setUserAgent to override the session-wide + * user agent. + */ + setUserAgent(userAgent: string, acceptLanguages?: string): void; cookies: Cookies; protocol: Protocol; webRequest: WebRequest; @@ -2198,7 +2358,7 @@ declare namespace Electron { * Open the given external protocol URL in the desktop's default manner. (For * example, mailto: URLs in the user's default mail agent). */ - openExternal(url: string, options: OpenExternalOptions, callback: (error: Error) => void): boolean; + openExternal(url: string, options?: OpenExternalOptions, callback?: (error: Error) => void): boolean; /** * Open the given file in the desktop's default manner. */ @@ -2216,18 +2376,22 @@ declare namespace Electron { * Creates or updates a shortcut link at shortcutPath. */ writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean; + /** + * Creates or updates a shortcut link at shortcutPath. + */ + writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean; } type ShortcutDetails = { // Docs: http://electron.atom.io/docs/api/structures/shortcut-details - appUserModelId: string; - args: string; - cwd: string; - description: string; - icon: string; - iconIndex: number; + appUserModelId?: string; + args?: string; + cwd?: string; + description?: string; + icon?: string; + iconIndex?: number; target: string; } @@ -2237,7 +2401,7 @@ declare namespace Electron { on(event: 'accent-color-changed', listener: (event: Event, /** - * The new RGBA color the user assigned to be there system accent color. + * The new RGBA color the user assigned to be their system accent color. */ newColor: string) => void): this; on(event: 'color-changed', listener: (event: Event) => void): this; @@ -2250,8 +2414,8 @@ declare namespace Electron { getAccentColor(): string; getColor(color: '3d-dark-shadow' | '3d-face' | '3d-highlight' | '3d-light' | '3d-shadow' | 'active-border' | 'active-caption' | 'active-caption-gradient' | 'app-workspace' | 'button-text' | 'caption-text' | 'desktop' | 'disabled-text' | 'highlight' | 'highlight-text' | 'hotlight' | 'inactive-border' | 'inactive-caption' | 'inactive-caption-gradient' | 'inactive-caption-text' | 'info-background' | 'info-text' | 'menu' | 'menu-highlight' | 'menubar' | 'menu-text' | 'scrollbar' | 'window' | 'window-frame' | 'window-text'): string; /** - * Get the value of key in system preferences. This API reads from NSUserDefaults - * on macOS, some popular key and types are: + * Get the value of key in system preferences. This API uses NSUserDefaults on + * macOS. Some popular key and types are: */ getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): void; /** @@ -2274,6 +2438,12 @@ declare namespace Electron { * contains the user information dictionary sent along with the notification. */ postNotification(event: string, userInfo: any): void; + /** + * Set the value of key in system preferences. Note that type should match actual + * type of value. An exception is thrown if they don't. This API uses + * NSUserDefaults on macOS. Some popular key and types are: + */ + setUserDefault(key: string, type: string, value: string): void; /** * Same as subscribeNotification, but uses NSNotificationCenter for local defaults. * This is necessary for events such as NSUserDefaultsDidChangeNotification @@ -2318,7 +2488,7 @@ declare namespace Electron { click: Function; flags?: string[]; icon: NativeImage; - tooltip: string; + tooltip?: string; } class Tray extends EventEmitter { @@ -2413,7 +2583,7 @@ declare namespace Electron { * shown instead of the tray icon's context menu. The position is only available on * Windows, and it is (0, 0) by default. */ - popUpContextMenu(menu: Menu, position: Position): void; + popUpContextMenu(menu?: Menu, position?: Position): void; /** * Sets the context menu for this icon. */ @@ -2427,7 +2597,7 @@ declare namespace Electron { /** * Sets the image associated with this tray icon. */ - setImage(image: NativeImage): void; + setImage(image: NativeImage | string): void; /** * Sets the image associated with this tray icon when pressed on macOS. */ @@ -2442,14 +2612,6 @@ declare namespace Electron { setToolTip(toolTip: string): void; } - type UploadBlob = { - - // Docs: http://electron.atom.io/docs/api/structures/upload-blob - - blobUUID: string; - type: string; - } - type UploadData = { // Docs: http://electron.atom.io/docs/api/structures/upload-data @@ -2459,36 +2621,6 @@ declare namespace Electron { file: string; } - type UploadFile = { - - // Docs: http://electron.atom.io/docs/api/structures/upload-file - - filePath: string; - length: number; - modificationTime: number; - offset: number; - type: string; - } - - type UploadFileSystem = { - - // Docs: http://electron.atom.io/docs/api/structures/upload-file-system - - filsSystemURL: string; - length: number; - modificationTime: number; - offset: number; - type: string; - } - - type UploadRawData = { - - // Docs: http://electron.atom.io/docs/api/structures/upload-raw-data - - bytes: Buffer; - type: string; - } - class WebContents extends EventEmitter { // Docs: http://electron.atom.io/docs/api/web-contents @@ -2496,18 +2628,28 @@ declare namespace Electron { static fromId(id: number): WebContents; static getAllWebContents(): WebContents[]; static getFocusedWebContents(): WebContents; + /** + * Emitted before dispatching the keydown and keyup events in the page. Calling + * event.preventDefault will prevent the page keydown/keyup events from being + * dispatched. + */ + on(event: 'before-input-event', listener: (event: Event, + /** + * Input properties + */ + input: Input) => void): this; /** * Emitted when failed to verify the certificate for url. The usage is the same * with the certificate-error event of app. */ on(event: 'certificate-error', listener: (event: Event, - url: URL, + url: string, /** * The error code */ error: string, certificate: Certificate, - callback: Function) => void): this; + callback: (isTrusted: boolean) => void) => void): this; /** * Emitted when there is a new context menu that needs to be handled. */ @@ -2532,19 +2674,19 @@ declare namespace Electron { */ on(event: 'cursor-changed', listener: (event: Event, type: string, - image: NativeImage, + image?: NativeImage, /** * scaling factor for the custom cursor */ - scale: number, + scale?: number, /** * the size of the `image` */ - size: Size, + size?: Size, /** * coordinates of the custom cursor's hotspot */ - hotspot: Hotspot) => void): this; + hotspot?: Hotspot) => void): this; /** * Emitted when webContents is destroyed. */ @@ -2573,8 +2715,7 @@ declare namespace Electron { /** * This event is like did-finish-load but emitted when the load failed or was * cancelled, e.g. window.stop() is invoked. The full list of error codes and their - * meaning is available here. Note that redirect responses will emit errorCode -3; - * you may want to ignore that error explicitly. + * meaning is available here. */ on(event: 'did-fail-load', listener: (event: Event, errorCode: number, @@ -2655,7 +2796,7 @@ declare namespace Electron { on(event: 'login', listener: (event: Event, request: Request, authInfo: AuthInfo, - callback: Function) => void): this; + callback: (username: string, password: string) => void) => void): this; /** * Emitted when media is paused or done playing. */ @@ -2668,9 +2809,11 @@ declare namespace Electron { * Emitted when the page requests to open a new window for a url. It could be * requested by window.open or an external link like . By * default a new BrowserWindow will be created for the url. Calling - * event.preventDefault() will prevent creating new windows. In such case, the - * event.newGuest may be set with a reference to a BrowserWindow instance to make - * it used by the Electron's runtime. + * event.preventDefault() will prevent Electron from automatically creating a new + * BrowserWindow. If you call event.preventDefault() and manually create a new + * BrowserWindow then you must set event.newGuest to reference the new + * BrowserWindow instance, failing to do so may result in unexpected behavior. For + * example: */ on(event: 'new-window', listener: (event: Event, url: string, @@ -2722,7 +2865,7 @@ declare namespace Electron { */ on(event: 'select-bluetooth-device', listener: (event: Event, devices: BluetoothDevice[], - callback: Function) => void): this; + callback: (deviceId: string) => void) => void): this; /** * Emitted when a client certificate is requested. The usage is the same with the * select-client-certificate event of app. @@ -2730,12 +2873,30 @@ declare namespace Electron { on(event: 'select-client-certificate', listener: (event: Event, url: URL, certificateList: Certificate[], - callback: Function) => void): this; + callback: (certificate: Certificate) => void) => void): this; /** * Emitted when mouse moves over a link or the keyboard moves the focus to a link. */ on(event: 'update-target-url', listener: (event: Event, url: string) => void): this; + /** + * Emitted when a 's web contents is being attached to this web contents. + * Calling event.preventDefault() will destroy the guest page. This event can be + * used to configure webPreferences for the webContents of a before it's + * loaded, and provides the ability to set settings that can't be set via + * attributes. + */ + on(event: 'will-attach-webview', listener: (event: Event, + /** + * The web preferences that will be used by the guest page. This object can be + * modified to adjust the preferences for the guest page. + */ + webPreferences: any, + /** + * The other `` parameters such as the `src` URL. This object can be + * modified to adjust the parameters of the guest page. + */ + params: any) => void): this; /** * Emitted when a user or the page wants to start navigation. It can happen when * the window.location object is changed or a user clicks a link in the page. This @@ -2752,6 +2913,19 @@ declare namespace Electron { * creation: */ addWorkSpace(path: string): void; + /** + * Begin subscribing for presentation events and captured frames, the callback will + * be called with callback(frameBuffer, dirtyRect) when there is a presentation + * event. The frameBuffer is a Buffer that contains raw pixel data. On most + * machines, the pixel data is effectively stored in 32bit BGRA format, but the + * actual representation depends on the endianness of the processor (most modern + * processors are little-endian, on machines with big-endian processors the data is + * in 32bit ARGB format). The dirtyRect is an object with x, y, width, height + * properties that describes which part of the page was repainted. If onlyDirty is + * set to true, frameBuffer will only contain the repainted area. onlyDirty + * defaults to false. + */ + beginFrameSubscription(callback: (frameBuffer: Buffer, dirtyRect: Rectangle) => void): void; /** * Begin subscribing for presentation events and captured frames, the callback will * be called with callback(frameBuffer, dirtyRect) when there is a presentation @@ -2774,6 +2948,12 @@ declare namespace Electron { * data of the snapshot. Omitting rect will capture the whole visible page. */ capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; + /** + * Captures a snapshot of the page within rect. Upon completion callback will be + * called with callback(image). The image is an instance of NativeImage that stores + * data of the snapshot. Omitting rect will capture the whole visible page. + */ + capturePage(callback: (image: NativeImage) => void): void; /** * Clears the navigation history. */ @@ -2823,17 +3003,18 @@ declare namespace Electron { * We recommend that you use the returned Promise to handle code that results in a * Promise. */ - executeJavaScript(code: string, userGesture: boolean, callback: (result: any) => void): Promise; + executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise; /** * Starts a request to find all matches for the text in the web page and returns an * Integer representing the request id used for the request. The result of the * request can be obtained by subscribing to found-in-page event. */ - findInPage(text: string, options: FindInPageOptions): void; + findInPage(text: string, options?: FindInPageOptions): void; getFrameRate(): number; getTitle(): string; getURL(): string; getUserAgent(): string; + getWebRTCIPHandlingPolicy(): void; /** * Sends a request to get current zoom factor, the callback will be called with * callback(zoomFactor). @@ -2882,8 +3063,9 @@ declare namespace Electron { */ inspectServiceWorker(): void; /** - * If offscreen rendering is enabled invalidates the frame and generates a new one - * through the 'paint' event. + * Schedules a full repaint of the window this web contents is in. If offscreen + * rendering is enabled invalidates the frame and generates a new one through the + * 'paint' event. */ invalidate(): void; isAudioMuted(): boolean; @@ -2902,11 +3084,11 @@ declare namespace Electron { * http:// or file://. If the load should bypass http cache then use the pragma * header to achieve it. */ - loadURL(url: URL, options: LoadURLOptions): void; + loadURL(url: string, options?: LoadURLOptions): void; /** * Opens the devtools. */ - openDevTools(options: OpenDevToolsOptions): void; + openDevTools(options?: OpenDevToolsOptions): void; /** * Executes the editing command paste in web page. */ @@ -2922,11 +3104,12 @@ declare namespace Electron { * false, printBackground: false}). Use page-break-before: always; CSS style to * force to print to a new page. */ - print(options: PrintOptions): void; + print(options?: PrintOptions): void; /** * Prints window's web page as PDF with Chromium's preview printing custom * settings. The callback will be called with callback(error, data) on completion. - * The data is a Buffer that contains the generated PDF data. By default, an empty + * The data is a Buffer that contains the generated PDF data. The landscape will be + * ignored if @page CSS at-rule is used in the web page. By default, an empty * options will be regarded as: Use page-break-before: always; CSS style to force * to print to a new page. An example of webContents.printToPDF: */ @@ -2955,10 +3138,7 @@ declare namespace Electron { * Executes the editing command replaceMisspelling in web page. */ replaceMisspelling(text: string): void; - /** - * Returns true if the process of saving page has been initiated successfully. - */ - savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML', callback: (error: Error) => void): void; + savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML', callback: (error: Error) => void): boolean; /** * Executes the editing command selectAll in web page. */ @@ -3003,6 +3183,11 @@ declare namespace Electron { * Sets the maximum and minimum pinch-to-zoom level. */ setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; + /** + * Setting the WebRTC IP handling policy allows you to control which IPs are + * exposed via WebRTC. See BrowserLeaks for more details. + */ + setWebRTCIPHandlingPolicy(policy: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'): void; /** * Changes the zoom factor to the specified factor. Zoom factor is zoom percent * divided by 100, so 300% = 3.0. @@ -3088,7 +3273,7 @@ declare namespace Electron { * requestFullScreen can only be invoked by a gesture from the user. Setting * userGesture to true will remove this limitation. */ - executeJavaScript(code: string, userGesture: boolean): void; + executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): void; /** * Returns an object describing usage information of Blink's internal memory * caches. This will generate: @@ -3111,7 +3296,7 @@ declare namespace Electron { * the value of false to omit it from the registration. An example of registering a * privileged scheme, without bypassing Content Security Policy: */ - registerURLSchemeAsPrivileged(scheme: string, options: RegisterURLSchemeAsPrivilegedOptions): void; + registerURLSchemeAsPrivileged(scheme: string, options?: RegisterURLSchemeAsPrivilegedOptions): void; /** * Registers the scheme as secure scheme. Secure schemes do not trigger mixed * content warnings. For example, https and data are secure schemes because they @@ -3127,7 +3312,7 @@ declare namespace Electron { * must be an object that has a spellCheck method that returns whether the word * passed is correctly spelled. An example of using node-spellchecker as provider: */ - setSpellCheckProvider(language: string, autoCorrectWord: boolean, provider: any): void; + setSpellCheckProvider(language: string, autoCorrectWord: boolean, provider: Provider): void; /** * Sets the maximum and minimum pinch-to-zoom level. */ @@ -3154,73 +3339,75 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/web-request - /** - * The listener will be called with listener(details) when a server initiated - * redirect is about to occur. - */ - onBeforeRedirect(filter: any, listener: (details: OnBeforeRedirectDetails) => void): void; - /** - * The listener will be called with listener(details, callback) when a request is - * about to occur. The uploadData is an array of UploadData objects. The callback - * has to be called with an response object. - */ - onBeforeRequest(filter: any, listener: (details: OnBeforeRequestDetails, callback: (response: Response) => void) => void): void; - /** - * The listener will be called with listener(details, callback) before sending an - * HTTP request, once the request headers are available. This may occur after a TCP - * connection is made to the server, but before any http data is sent. The callback - * has to be called with an response object. - */ - onBeforeSendHeaders(filter: any, listener: Function): void; - /** - * The listener will be called with listener(details) when a request is completed. - */ - onCompleted(filter: any, listener: (details: OnCompletedDetails) => void): void; - /** - * The listener will be called with listener(details) when an error occurs. - */ - onErrorOccurred(filter: any, listener: (details: OnErrorOccurredDetails) => void): void; - /** - * The listener will be called with listener(details, callback) when HTTP response - * headers of a request have been received. The callback has to be called with an - * response object. - */ - onHeadersReceived(filter: any, listener: Function): void; - /** - * The listener will be called with listener(details) when first byte of the - * response body is received. For HTTP requests, this means that the status line - * and response headers are available. - */ - onResponseStarted(filter: any, listener: (details: OnResponseStartedDetails) => void): void; - /** - * The listener will be called with listener(details) just before a request is - * going to be sent to the server, modifications of previous onBeforeSendHeaders - * response are visible by the time this listener is fired. - */ - onSendHeaders(filter: any, listener: (details: OnSendHeadersDetails) => void): void; } interface AboutPanelOptionsOptions { /** * The app's name. */ - applicationName: string; + applicationName?: string; /** * The app's version. */ - applicationVersion: string; + applicationVersion?: string; /** * Copyright information. */ - copyright: string; + copyright?: string; /** * Credit information. */ - credits: string; + credits?: string; /** * The app's build version number. */ - version: string; + version?: string; + } + + interface AddRepresentationOptions { + /** + * The scale factor to add the image representation for. + */ + scaleFactor: number; + /** + * Defaults to 0. Required if a bitmap buffer is specified as . + */ + width?: number; + /** + * Defaults to 0. Required if a bitmap buffer is specified as . + */ + height?: number; + /** + * The buffer containing the raw image data. + */ + buffer?: Buffer; + /** + * The data URL containing either a base 64 encoded PNG or JPEG image. + */ + dataURL?: string; + } + + interface AppDetailsOptions { + /** + * Window's . It has to be set, otherwise the other options will have no effect. + */ + appId?: string; + /** + * Window's . + */ + appIconPath?: string; + /** + * Index of the icon in . Ignored when is not set. Default is . + */ + appIconIndex?: number; + /** + * Window's . + */ + relaunchCommand?: string; + /** + * Window's . + */ + relaunchDisplayName?: string; } interface AuthInfo { @@ -3231,22 +3418,29 @@ declare namespace Electron { realm: string; } + interface BitmapOptions { + /** + * Defaults to 1.0. + */ + scaleFactor?: number; + } + interface BrowserWindowConstructorOptions { /** * Window's width in pixels. Default is . */ - width: number; + width?: number; /** * Window's height in pixels. Default is . */ - height: number; + height?: number; /** - * ( if y is used) Window's left offset from screen. Default is to center the + * ( if y is used) - Window's left offset from screen. Default is to center the * window. */ x?: number; /** - * ( if x is used) Window's top offset from screen. Default is to center the + * ( if x is used) - Window's top offset from screen. Default is to center the * window. */ y?: number; @@ -3254,156 +3448,156 @@ declare namespace Electron { * The and would be used as web page's size, which means the actual window's size * will include window frame's size and be slightly larger. Default is . */ - useContentSize: boolean; + useContentSize?: boolean; /** * Show window in the center of the screen. */ - center: boolean; + center?: boolean; /** * Window's minimum width. Default is . */ - minWidth: number; + minWidth?: number; /** * Window's minimum height. Default is . */ - minHeight: number; + minHeight?: number; /** * Window's maximum width. Default is no limit. */ - maxWidth: number; + maxWidth?: number; /** * Window's maximum height. Default is no limit. */ - maxHeight: number; + maxHeight?: number; /** * Whether window is resizable. Default is . */ - resizable: boolean; + resizable?: boolean; /** * Whether window is movable. This is not implemented on Linux. Default is . */ - movable: boolean; + movable?: boolean; /** * Whether window is minimizable. This is not implemented on Linux. Default is . */ - minimizable: boolean; + minimizable?: boolean; /** * Whether window is maximizable. This is not implemented on Linux. Default is . */ - maximizable: boolean; + maximizable?: boolean; /** * Whether window is closable. This is not implemented on Linux. Default is . */ - closable: boolean; + closable?: boolean; /** * Whether the window can be focused. Default is . On Windows setting also implies * setting . On Linux setting makes the window stop interacting with wm, so the * window will always stay on top in all workspaces. */ - focusable: boolean; + focusable?: boolean; /** * Whether the window should always stay on top of other windows. Default is . */ - alwaysOnTop: boolean; + alwaysOnTop?: boolean; /** * Whether the window should show in fullscreen. When explicitly set to the * fullscreen button will be hidden or disabled on macOS. Default is . */ - fullscreen: boolean; + fullscreen?: boolean; /** * Whether the window can be put into fullscreen mode. On macOS, also whether the * maximize/zoom button should toggle full screen mode or maximize window. Default * is . */ - fullscreenable: boolean; + fullscreenable?: boolean; /** * Whether to show the window in taskbar. Default is . */ - skipTaskbar: boolean; + skipTaskbar?: boolean; /** * The kiosk mode. Default is . */ - kiosk: boolean; + kiosk?: boolean; /** * Default window title. Default is . */ - title: string; + title?: string; /** * The window icon. On Windows it is recommended to use icons to get best visual * effects, you can also leave it undefined so the executable's icon will be used. */ - icon: NativeImage | string; + icon?: NativeImage | string; /** * Whether window should be shown when created. Default is . */ - show: boolean; + show?: boolean; /** * Specify to create a . Default is . */ - frame: boolean; + frame?: boolean; /** * Specify parent window. Default is . */ - parent: BrowserWindow; + parent?: BrowserWindow; /** * Whether this is a modal window. This only works when the window is a child * window. Default is . */ - modal: boolean; + modal?: boolean; /** * Whether the web view accepts a single mouse-down event that simultaneously * activates the window. Default is . */ - acceptFirstMouse: boolean; + acceptFirstMouse?: boolean; /** * Whether to hide cursor when typing. Default is . */ - disableAutoHideCursor: boolean; + disableAutoHideCursor?: boolean; /** * Auto hide the menu bar unless the key is pressed. Default is . */ - autoHideMenuBar: boolean; + autoHideMenuBar?: boolean; /** * Enable the window to be resized larger than screen. Default is . */ - enableLargerThanScreen: boolean; + enableLargerThanScreen?: boolean; /** * Window's background color as Hexadecimal value, like or or (alpha is supported). * Default is (white). */ - backgroundColor: string; + backgroundColor?: string; /** * Whether window should have a shadow. This is only implemented on macOS. Default * is . */ - hasShadow: boolean; + hasShadow?: boolean; /** * Forces using dark theme for the window, only works on some GTK+3 desktop * environments. Default is . */ - darkTheme: boolean; + darkTheme?: boolean; /** * Makes the window . Default is . */ - transparent: boolean; + transparent?: boolean; /** * The type of window, default is normal window. See more about this below. */ - type: string; + type?: string; /** * The style of window title bar. Default is . Possible values are: */ - titleBarStyle: string; + titleBarStyle?: string; /** * Use style for frameless windows on Windows, which adds standard window frame. * Setting it to will remove window shadow and window animations. Default is . */ - thickFrame: boolean; + thickFrame?: boolean; /** * Add a type of vibrancy effect to the window, only on macOS. Can be , , , , , , , * , or . */ - vibrancy: string; + vibrancy?: string; /** * Controls the behavior on macOS when option-clicking the green stoplight button * on the toolbar or by clicking the Window > Zoom menu item. If , the window will @@ -3411,11 +3605,20 @@ declare namespace Electron { * to the width of the screen. This will also affect the behavior when calling * directly. Default is . */ - zoomToPageWidth: boolean; + zoomToPageWidth?: boolean; /** * Settings of web page's features. */ - webPreferences: WebPreferences; + webPreferences?: WebPreferences; + } + + interface CertificateVerifyProcRequest { + hostname: string; + certificate: Certificate; + /** + * Verification result from chromium. + */ + error: string; } interface ClearStorageDataOptions { @@ -3439,7 +3642,7 @@ declare namespace Electron { * will not affect process.argv, and is mainly used by developers to control some * low-level Chromium behaviors. */ - appendSwitch?: (the_switch: string, value: string) => void; + appendSwitch?: (the_switch: string, value?: string) => void; /** * Append an argument to Chromium's command line. The argument will be quoted * correctly. Note: This will not affect process.argv. @@ -3542,7 +3745,7 @@ declare namespace Electron { } interface CrashReporterStartOptions { - companyName: string; + companyName?: string; /** * URL that crash reports will be sent to as POST. */ @@ -3550,20 +3753,67 @@ declare namespace Electron { /** * Defaults to . */ - productName: string; + productName?: string; /** - * Send the crash report without user interaction. Default is . + * Whether crash reports should be sent to the server Default is . */ - autoSubmit: boolean; + uploadToServer?: boolean; /** * Default is . */ - ignoreSystemCrashHandler: boolean; + ignoreSystemCrashHandler?: boolean; /** * An object you can define that will be sent along with the report. Only string - * properties are sent correctly, Nested objects are not supported. + * properties are sent correctly. Nested objects are not supported. */ - extra: Extra; + extra?: Extra; + } + + interface CreateFromBufferOptions { + /** + * Required for bitmap buffers. + */ + width?: number; + /** + * Required for bitmap buffers. + */ + height?: number; + /** + * Defaults to 1.0. + */ + scaleFactor?: number; + } + + interface CreateInterruptedDownloadOptions { + /** + * Absolute path of the download. + */ + path: string; + /** + * Complete URL chain for the download. + */ + urlChain: string[]; + mimeType?: string; + /** + * Start range for the download. + */ + offset: number; + /** + * Total length of the download. + */ + length: number; + /** + * Last-Modified header value. + */ + lastModified: string; + /** + * ETag header value. + */ + eTag: string; + /** + * Time when download was started in number of seconds since UNIX epoch. + */ + startTime?: number; } interface CursorScreenPoint { @@ -3572,14 +3822,14 @@ declare namespace Electron { } interface Data { - text: string; - html: string; - image: NativeImage; - rtf: string; + text?: string; + html?: string; + image?: NativeImage; + rtf?: string; /** * The title of the url at . */ - bookmark: string; + bookmark?: string; } interface Details { @@ -3590,42 +3840,42 @@ declare namespace Electron { /** * The name of the cookie. Empty by default if omitted. */ - name: string; + name?: string; /** * The value of the cookie. Empty by default if omitted. */ - value: string; + value?: string; /** * The domain of the cookie. Empty by default if omitted. */ - domain: string; + domain?: string; /** * The path of the cookie. Empty by default if omitted. */ - path: string; + path?: string; /** * Whether the cookie should be marked as Secure. Defaults to false. */ - secure: boolean; + secure?: boolean; /** * Whether the cookie should be marked as HTTP only. Defaults to false. */ - httpOnly: boolean; + httpOnly?: boolean; /** - * - The expiration date of the cookie as the number of seconds since the UNIX - * epoch. If omitted then the cookie becomes a session cookie and will not be - * retained between sessions. + * The expiration date of the cookie as the number of seconds since the UNIX epoch. + * If omitted then the cookie becomes a session cookie and will not be retained + * between sessions. */ - expirationDate: number; + expirationDate?: number; } interface DevToolsExtensions { } interface DisplayBalloonOptions { - icon: NativeImage; - title: string; - content: string; + icon?: NativeImage | string; + title?: string; + content?: string; } interface Dock { @@ -3633,10 +3883,9 @@ declare namespace Electron { * When critical is passed, the dock icon will bounce until either the application * becomes active or the request is canceled. When informational is passed, the * dock icon will bounce for one second. However, the request remains active until - * either the application becomes active or the request is canceled. Returns an ID - * representing the request. + * either the application becomes active or the request is canceled. */ - bounce: (type: 'critical' | 'informational') => void; + bounce: (type?: 'critical' | 'informational') => number; /** * Cancel the bounce of id. */ @@ -3666,7 +3915,26 @@ declare namespace Electron { /** * Sets the image associated with this dock icon. */ - setIcon: (image: NativeImage) => void; + setIcon: (image: NativeImage | string) => void; + } + + interface EnableNetworkEmulationOptions { + /** + * Whether to emulate network outage. Defaults to false. + */ + offline?: boolean; + /** + * RTT in ms. Defaults to 0 which will disable latency throttling. + */ + latency?: number; + /** + * Download rate in Bps. Defaults to 0 which will disable download throttling. + */ + downloadThroughput?: number; + /** + * Upload rate in Bps. Defaults to 0 which will disable upload throttling. + */ + uploadThroughput?: number; } interface ExtraSize { @@ -3674,57 +3942,61 @@ declare namespace Electron { height: number; } + interface FileIconOptions { + size: string; + } + interface Filter { /** * Retrieves cookies which are associated with . Empty implies retrieving cookies * of all urls. */ - url: string; + url?: string; /** * Filters cookies by name. */ - name: string; + name?: string; /** * Retrieves cookies whose domains match or are subdomains of */ - domain: string; + domain?: string; /** * Retrieves cookies whose path matches . */ - path: string; + path?: string; /** * Filters cookies by their Secure property. */ - secure: boolean; + secure?: boolean; /** * Filters out session or persistent cookies. */ - session: boolean; + session?: boolean; } interface FindInPageOptions { /** * Whether to search forward or backward, defaults to . */ - forward: boolean; + forward?: boolean; /** * Whether the operation is first request or a follow up, defaults to . */ - findNext: boolean; + findNext?: boolean; /** * Whether search should be case-sensitive, defaults to . */ - matchCase: boolean; + matchCase?: boolean; /** * Whether to look only at the start of words. defaults to . */ - wordStart: boolean; + wordStart?: boolean; /** * When combined with , accepts a match in the middle of a word if the match begins * with an uppercase letter followed by a lowercase or non-letter. Accepts several * other intra-word matches, defaults to . */ - medialCapitalAsWordStart: boolean; + medialCapitalAsWordStart?: boolean; } interface FromPartitionOptions { @@ -3756,6 +4028,41 @@ declare namespace Electron { password: string; } + interface Input { + /** + * Either or + */ + type: string; + /** + * Equivalent to + */ + key: string; + /** + * Equivalent to + */ + code: string; + /** + * Equivalent to + */ + isAutoRepeat: boolean; + /** + * Equivalent to + */ + shift: boolean; + /** + * Equivalent to + */ + control: boolean; + /** + * Equivalent to + */ + alt: boolean; + /** + * Equivalent to + */ + meta: boolean; + } + interface InterceptBufferProtocolRequest { url: string; referrer: string; @@ -3785,7 +4092,13 @@ declare namespace Electron { } interface Item { + /** + * or Array - The path(s) to the file(s) being dragged. + */ file: string; + /** + * The image must be non-empty on macOS. + */ icon: NativeImage; } @@ -3808,22 +4121,29 @@ declare namespace Electron { /** * A HTTP Referrer url. */ - httpReferrer: string; + httpReferrer?: string; /** * A user agent originating the request. */ - userAgent: string; + userAgent?: string; /** * Extra headers separated by "\n" */ - extraHeaders: string; + extraHeaders?: string; /** - * [] (optional) + * [] - (optional) */ postData?: UploadRawData | UploadFile | UploadFileSystem | UploadBlob; + /** + * Base url (with trailing path separator) for files to be loaded by the data url. + * This is needed only if the specified is a data url and needs to load other + * files. + */ + baseURLForDataURL?: string; } interface LoginItemSettings { + options?: Options; /** * if the app is set to open at login. */ @@ -3852,6 +4172,17 @@ declare namespace Electron { restoreState: boolean; } + interface LoginItemSettingsOptions { + /** + * The executable path to compare against. Defaults to . + */ + path?: string; + /** + * The command-line arguments to compare against. Defaults to an empty array. + */ + args?: string[]; + } + interface MenuItemConstructorOptions { /** * Will be called with when the menu item is clicked. @@ -3903,7 +4234,7 @@ declare namespace Electron { * Can be , , , or . On Windows, "question" displays the same icon as "info", * unless you set an icon using the "icon" option. */ - type: string; + type?: string; /** * Array of texts for buttons. On Windows, an empty array will result in one button * labeled "OK". @@ -3913,11 +4244,11 @@ declare namespace Electron { * Index of the button in the buttons array which will be selected by default when * the message box opens. */ - defaultId: number; + defaultId?: number; /** * Title of the message box, some platforms will not show it. */ - title: string; + title?: string; /** * Content of the message box. */ @@ -3925,97 +4256,31 @@ declare namespace Electron { /** * Extra information of the message. */ - detail: string; - icon: NativeImage; + detail?: string; /** - * The value will be returned when user cancels the dialog instead of clicking the - * buttons of the dialog. By default it is the index of the buttons that have - * "cancel" or "no" as label, or 0 if there is no such buttons. On macOS and - * Windows the index of "Cancel" button will always be used as , not matter whether - * it is already specified. + * If provided, the message box will include a checkbox with the given label. The + * checkbox state can be inspected only when using . */ - cancelId: number; + checkboxLabel?: string; + /** + * Initial checked state of the checkbox. by default. + */ + checkboxChecked?: boolean; + icon?: NativeImage; + /** + * The index of the button to be used to cancel the dialog, via the key. By default + * this is assigned to the first button with "cancel" or "no" as the label. If no + * such labeled buttons exist and this option is not set, will be used as the + * return value or callback response. This option is ignored on Windows. + */ + cancelId?: number; /** * On Windows Electron will try to figure out which one of the are common buttons * (like "Cancel" or "Yes"), and show the others as command links in the dialog. * This can make the dialog appear in the style of modern Windows apps. If you * don't like this behavior, you can set to . */ - noLink: boolean; - } - - interface OnBeforeRedirectDetails { - id: string; - url: string; - method: string; - resourceType: string; - timestamp: number; - redirectURL: string; - statusCode: number; - /** - * The server IP address that the request was actually sent to. - */ - ip: string; - fromCache: boolean; - responseHeaders: ResponseHeaders; - } - - interface OnBeforeRequestDetails { - id: number; - url: string; - method: string; - resourceType: string; - timestamp: number; - uploadData: UploadData[]; - } - - interface OnCompletedDetails { - id: number; - url: string; - method: string; - resourceType: string; - timestamp: number; - responseHeaders: ResponseHeaders; - fromCache: boolean; - statusCode: number; - statusLine: string; - } - - interface OnErrorOccurredDetails { - id: number; - url: string; - method: string; - resourceType: string; - timestamp: number; - fromCache: boolean; - /** - * The error description. - */ - error: string; - } - - interface OnResponseStartedDetails { - id: number; - url: string; - method: string; - resourceType: string; - timestamp: number; - responseHeaders: ResponseHeaders; - /** - * Indicates whether the response was fetched from disk cache. - */ - fromCache: boolean; - statusCode: number; - statusLine: string; - } - - interface OnSendHeadersDetails { - id: number; - url: string; - method: string; - resourceType: string; - timestamp: number; - requestHeaders: RequestHeaders; + noLink?: boolean; } interface OpenDevToolsOptions { @@ -4027,18 +4292,28 @@ declare namespace Electron { } interface OpenDialogOptions { - title: string; - defaultPath: string; + title?: string; + defaultPath?: string; /** * Custom label for the confirmation button, when left empty the default label will * be used. */ - buttonLabel: string; - filters: FileFilter[]; + buttonLabel?: string; + filters?: FileFilter[]; /** - * Contains which features the dialog should use, can contain , , , and . + * Contains which features the dialog should use. The following values are + * supported: */ properties?: string[]; + /** + * Normalize the keyboard access keys across platforms. Default is . Enabling this + * assumes is used in the button labels for the placement of the keyboard shortcut + * access key and labels will be converted so they work correctly on each platform, + * characters are removed on macOS, converted to on Linux, and left untouched on + * Windows. For example, a button label of will be converted to on Linux and on + * macOS and can be selected via on Windows and Linux. + */ + normalizeAccessKeys?: boolean; } interface OpenExternalOptions { @@ -4092,6 +4367,27 @@ declare namespace Electron { y: number; } + interface PopupOptions { + /** + * Default is the current mouse cursor position. + */ + x?: number; + /** + * ( if is used) - Default is the current mouse cursor position. + */ + y?: number; + /** + * Set to to have this method return immediately called, to return after the menu + * has been selected or closed. Defaults to . + */ + async?: boolean; + /** + * The index of the menu item to be positioned under the mouse cursor at the + * specified coordinates. Default is -1. + */ + positioningItem?: number; + } + interface Position { x: number; y: number; @@ -4113,24 +4409,24 @@ declare namespace Electron { * Specifies the type of margins to use. Uses 0 for default margin, 1 for no * margin, and 2 for minimum margin. */ - marginsType: number; + marginsType?: number; /** * Specify page size of the generated PDF. Can be , , , , , or an Object containing * and in microns. */ - pageSize: string; + pageSize?: string; /** * Whether to print CSS backgrounds. */ - printBackground: boolean; + printBackground?: boolean; /** * Whether to print selection only. */ - printSelectionOnly: boolean; + printSelectionOnly?: boolean; /** * for landscape, for portrait. */ - landscape: boolean; + landscape?: boolean; } interface ProcessMemoryInfo { @@ -4156,11 +4452,18 @@ declare namespace Electron { interface ProgressBarOptions { /** - * Mode for the progress bar. Can be , , , , or . + * - Mode for the progress bar. Can be , , , , or . */ mode: string; } + interface Provider { + /** + * Returns + */ + spellCheck: (text: string) => void; + } + interface ReadBookmark { title: string; url: string; @@ -4176,8 +4479,8 @@ declare namespace Electron { interface RedirectRequest { url: string; method: string; - session: Session; - uploadData: UploadData; + session?: Session; + uploadData?: UploadData; } interface RegisterBufferProtocolRequest { @@ -4201,6 +4504,13 @@ declare namespace Electron { uploadData: UploadData[]; } + interface RegisterStandardSchemesOptions { + /** + * to register the scheme as secure. Default . + */ + secure?: boolean; + } + interface RegisterStringProtocolRequest { url: string; referrer: string; @@ -4233,7 +4543,7 @@ declare namespace Electron { interface RelaunchOptions { args?: string[]; - execPath: string; + execPath?: string; } interface Request { @@ -4243,8 +4553,14 @@ declare namespace Electron { } interface ResizeOptions { - width: number; - height: number; + /** + * Defaults to the image's width. + */ + width?: number; + /** + * Defaults to the image's height + */ + height?: number; /** * The desired quality of the resize image. Possible values are , or . The default * is . These values express a desired quality/speed tradeoff. They are translated @@ -4252,7 +4568,7 @@ declare namespace Electron { * the underlying platform. It is possible for all three methods to be mapped to * the same algorithm on a given platform. */ - quality: string; + quality?: string; } interface ResourceUsage { @@ -4263,15 +4579,6 @@ declare namespace Electron { other: MemoryUsageDetails; } - interface Response { - cancel: boolean; - /** - * The original request is prevented from being sent or completed and is instead - * redirected to the given URL. - */ - redirectURL: string; - } - interface Result { requestId: number; /** @@ -4289,27 +4596,39 @@ declare namespace Electron { } interface SaveDialogOptions { - title: string; - defaultPath: string; + title?: string; + defaultPath?: string; /** * Custom label for the confirmation button, when left empty the default label will * be used. */ - buttonLabel: string; - filters: FileFilter[]; + buttonLabel?: string; + filters?: FileFilter[]; + /** + * Message to display above text fields. + */ + message?: string; + /** + * Custom label for the text displayed in front of the filename text field. + */ + nameFieldLabel?: string; + /** + * Show the tags input box, defaults to . + */ + showsTagField?: boolean; } interface Settings { /** * to open the app at login, to remove the app as a login item. Defaults to . */ - openAtLogin: boolean; + openAtLogin?: boolean; /** * to open the app as hidden. Defaults to . The user can edit this setting from the * System Preferences so should be checked when the app is opened to know the * current value. This setting is only supported on macOS. */ - openAsHidden: boolean; + openAsHidden?: boolean; } interface Size { @@ -4322,7 +4641,7 @@ declare namespace Electron { * Normal size of the page. This can be used in combination with the attribute to * manually resize the webview guest contents. */ - normal: Normal; + normal?: Normal; } interface SourcesOptions { @@ -4335,7 +4654,7 @@ declare namespace Electron { * The suggested size that the media source thumbnail should be scaled to, defaults * to . */ - thumbnailSize: ThumbnailSize; + thumbnailSize?: ThumbnailSize; } interface StartMonitoringOptions { @@ -4367,6 +4686,27 @@ declare namespace Electron { swapFree: number; } + interface ToBitmapOptions { + /** + * Defaults to 1.0. + */ + scaleFactor?: number; + } + + interface ToDataURLOptions { + /** + * Defaults to 1.0. + */ + scaleFactor?: number; + } + + interface ToPNGOptions { + /** + * Defaults to 1.0. + */ + scaleFactor?: number; + } + interface WorkAreaSize { height: number; width: number; @@ -4457,10 +4797,15 @@ declare namespace Electron { y: number; } - interface RequestHeaders { - } - - interface ResponseHeaders { + interface Options { + /** + * The executable path to compare against. Defaults to . + */ + path?: string; + /** + * The command-line arguments to compare against. Defaults to an empty array. + */ + args?: string[]; } interface ScreenSize { @@ -4507,11 +4852,16 @@ declare namespace Electron { * Whether to enable DevTools. If it is set to , can not use to open DevTools. * Default is . */ - devTools: boolean; + devTools?: boolean; /** * Whether node integration is enabled. Default is . */ - nodeIntegration: boolean; + nodeIntegration?: boolean; + /** + * Whether node integration is enabled in web workers. Default is . More about this + * can be found in . + */ + nodeIntegrationInWorker?: boolean; /** * Specifies a script that will be loaded before other scripts run in the page. * This script will always have access to node APIs no matter whether node @@ -4519,14 +4869,14 @@ declare namespace Electron { * the script. When node integration is turned off, the preload script can * reintroduce Node global symbols back to the global scope. See example . */ - preload: string; + preload?: string; /** * Sets the session used by the page. Instead of passing the Session object * directly, you can also choose to use the option instead, which accepts a * partition string. When both and are provided, will be preferred. Default is the * default session. */ - session: Session; + session?: Session; /** * Sets the session used by the page according to the session's partition string. * If starts with , the page will use a persistent session available to all pages @@ -4534,123 +4884,143 @@ declare namespace Electron { * session. By assigning the same , multiple pages can share the same session. * Default is the default session. */ - partition: string; + partition?: string; /** * The default zoom factor of the page, represents . Default is . */ - zoomFactor: number; + zoomFactor?: number; /** * Enables JavaScript support. Default is . */ - javascript: boolean; + javascript?: boolean; /** * When , it will disable the same-origin policy (usually using testing websites by - * people), and set and to if these two options are not set by user. Default is . + * people), and set to if this options has not been set by user. Default is . */ - webSecurity: boolean; - /** - * Allow an https page to display content like images from http URLs. Default is . - */ - allowDisplayingInsecureContent: boolean; + webSecurity?: boolean; /** * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is * . */ - allowRunningInsecureContent: boolean; + allowRunningInsecureContent?: boolean; /** * Enables image support. Default is . */ - images: boolean; + images?: boolean; /** * Make TextArea elements resizable. Default is . */ - textAreasAreResizable: boolean; + textAreasAreResizable?: boolean; /** * Enables WebGL support. Default is . */ - webgl: boolean; + webgl?: boolean; /** * Enables WebAudio support. Default is . */ - webaudio: boolean; + webaudio?: boolean; /** * Whether plugins should be enabled. Default is . */ - plugins: boolean; + plugins?: boolean; /** * Enables Chromium's experimental features. Default is . */ - experimentalFeatures: boolean; + experimentalFeatures?: boolean; /** * Enables Chromium's experimental canvas features. Default is . */ - experimentalCanvasFeatures: boolean; + experimentalCanvasFeatures?: boolean; /** * Enables scroll bounce (rubber banding) effect on macOS. Default is . */ - scrollBounce: boolean; + scrollBounce?: boolean; /** * A list of feature strings separated by , like to enable. The full list of * supported feature strings can be found in the file. */ - blinkFeatures: string; + blinkFeatures?: string; /** * A list of feature strings separated by , like to disable. The full list of * supported feature strings can be found in the file. */ - disableBlinkFeatures: string; + disableBlinkFeatures?: string; /** * Sets the default font for the font-family. */ - defaultFontFamily: DefaultFontFamily; + defaultFontFamily?: DefaultFontFamily; /** * Defaults to . */ - defaultFontSize: number; + defaultFontSize?: number; /** * Defaults to . */ - defaultMonospaceFontSize: number; + defaultMonospaceFontSize?: number; /** * Defaults to . */ - minimumFontSize: number; + minimumFontSize?: number; /** * Defaults to . */ - defaultEncoding: string; + defaultEncoding?: string; /** * Whether to throttle animations and timers when the page becomes background. * Defaults to . */ - backgroundThrottling: boolean; + backgroundThrottling?: boolean; /** - * Whether to enable offscreen rendering for the browser window. Defaults to . + * Whether to enable offscreen rendering for the browser window. Defaults to . See + * the for more details. */ - offscreen: boolean; + offscreen?: boolean; /** * Whether to enable Chromium OS-level sandbox. */ - sandbox: boolean; + sandbox?: boolean; + /** + * Whether to run Electron APIs and the specified script in a separate JavaScript + * context. Defaults to . The context that the script runs in will still have full + * access to the and globals but it will use its own set of JavaScript builtins (, + * , , etc.) and will be isolated from any changes made to the global environment + * by the loaded page. The Electron API will only be available in the script and + * not the loaded page. This option should be used when loading potentially + * untrusted remote content to ensure the loaded content cannot tamper with the + * script and any Electron APIs being used. This option uses the same technique + * used by . You can access this context in the dev tools by selecting the + * 'Electron Isolated Context' entry in the combo box at the top of the Console + * tab. This option is currently experimental and may change or be removed in + * future Electron releases. + */ + contextIsolation?: boolean; } interface DefaultFontFamily { /** * Defaults to . */ - standard: string; + standard?: string; /** * Defaults to . */ - serif: string; + serif?: string; /** * Defaults to . */ - sansSerif: string; + sansSerif?: string; /** * Defaults to . */ - monospace: string; + monospace?: string; + /** + * Defaults to . + */ + cursive?: string; + /** + * Defaults to . + */ + fantasy?: string; } } From 974d78a60323d3d37d1bce8c355ee8b03408d7b0 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Fri, 5 May 2017 13:54:18 -0700 Subject: [PATCH 309/328] update electron.d.ts --- npm/electron.d.ts | 4032 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 3367 insertions(+), 665 deletions(-) diff --git a/npm/electron.d.ts b/npm/electron.d.ts index fa01e38e868d..dc2404437194 100644 --- a/npm/electron.d.ts +++ b/npm/electron.d.ts @@ -1,7 +1,11 @@ -// Type definitions for Electron undefined +// Type definitions for Electron 1.6.8 // Project: http://electron.atom.io/ +// Definitions by: The Electron Team +// Definitions: https://github.com/electron/electron-typescript-definitions +/// +type GlobalEvent = Event; declare namespace Electron { class EventEmitter { @@ -24,84 +28,97 @@ declare namespace Electron { } - interface Event { - preventDefault: Function; + interface Event extends GlobalEvent { + preventDefault: () => void; sender: WebContents; - returnValue?: any; + returnValue: any; ctrlkey?: boolean; metaKey?: boolean; shiftKey?: boolean; } - - interface CommonInterface { clipboard: Electron.Clipboard; crashReporter: Electron.CrashReporter; nativeImage: typeof Electron.NativeImage; - NativeImage: typeof Electron.NativeImage; - shell: Electron.Shell; screen: Electron.Screen; + shell: Electron.Shell; } interface MainInterface extends CommonInterface { app: Electron.App; autoUpdater: Electron.AutoUpdater; + BrowserView: typeof Electron.BrowserView; BrowserWindow: typeof Electron.BrowserWindow; + ClientRequest: typeof Electron.ClientRequest; contentTracing: Electron.ContentTracing; + Cookies: typeof Electron.Cookies; + Debugger: typeof Electron.Debugger; dialog: Electron.Dialog; - ipcMain: Electron.IpcMain; + DownloadItem: typeof Electron.DownloadItem; globalShortcut: Electron.GlobalShortcut; + IncomingMessage: typeof Electron.IncomingMessage; + ipcMain: Electron.IpcMain; Menu: typeof Electron.Menu; - net: Electron.Net; MenuItem: typeof Electron.MenuItem; + net: Electron.Net; powerMonitor: Electron.PowerMonitor; powerSaveBlocker: Electron.PowerSaveBlocker; protocol: Electron.Protocol; session: typeof Electron.Session; - Session: typeof Electron.Session; systemPreferences: Electron.SystemPreferences; + TouchBar: typeof Electron.TouchBar; Tray: typeof Electron.Tray; webContents: typeof Electron.WebContents; - WebContents: typeof Electron.WebContents; - process: Electron.Process; + WebRequest: typeof Electron.WebRequest; } interface RendererInterface extends CommonInterface { + BrowserWindowProxy: typeof Electron.BrowserWindowProxy; desktopCapturer: Electron.DesktopCapturer; ipcRenderer: Electron.IpcRenderer; remote: Electron.Remote; webFrame: Electron.WebFrame; + webviewTag: Electron.WebviewTag; } interface AllElectron { - clipboard: Electron.Clipboard; - crashReporter: Electron.CrashReporter; - nativeImage: typeof Electron.NativeImage; - shell: Electron.Shell; app: Electron.App; autoUpdater: Electron.AutoUpdater; + BrowserView: typeof Electron.BrowserView; BrowserWindow: typeof Electron.BrowserWindow; + BrowserWindowProxy: typeof Electron.BrowserWindowProxy; + ClientRequest: typeof Electron.ClientRequest; + clipboard: Electron.Clipboard; contentTracing: Electron.ContentTracing; + Cookies: typeof Electron.Cookies; + crashReporter: Electron.CrashReporter; + Debugger: typeof Electron.Debugger; + desktopCapturer: Electron.DesktopCapturer; dialog: Electron.Dialog; - ipcMain: Electron.IpcMain; + DownloadItem: typeof Electron.DownloadItem; globalShortcut: Electron.GlobalShortcut; + IncomingMessage: typeof Electron.IncomingMessage; + ipcMain: Electron.IpcMain; + ipcRenderer: Electron.IpcRenderer; Menu: typeof Electron.Menu; - net: Electron.Net; MenuItem: typeof Electron.MenuItem; + nativeImage: typeof Electron.NativeImage; + net: Electron.Net; powerMonitor: Electron.PowerMonitor; powerSaveBlocker: Electron.PowerSaveBlocker; protocol: Electron.Protocol; + remote: Electron.Remote; screen: Electron.Screen; session: typeof Electron.Session; + shell: Electron.Shell; systemPreferences: Electron.SystemPreferences; + TouchBar: typeof Electron.TouchBar; Tray: typeof Electron.Tray; webContents: typeof Electron.WebContents; - process: Electron.Process; - desktopCapturer: Electron.DesktopCapturer; - ipcRenderer: Electron.IpcRenderer; - remote: Electron.Remote; webFrame: Electron.WebFrame; + WebRequest: typeof Electron.WebRequest; + webviewTag: Electron.WebviewTag; } interface App extends EventEmitter { @@ -114,19 +131,40 @@ declare namespace Electron { * https://www.chromium.org/developers/design-documents/accessibility for more * details. */ - on(event: 'accessibility-support-changed', listener: (event: Event, + on(event: 'accessibility-support-changed', listener: (event?: Event, /** * `true` when Chrome's accessibility support is enabled, `false` otherwise. */ - accessibilitySupportEnabled: boolean) => void): this; + accessibilitySupportEnabled?: boolean) => void): this; + once(event: 'accessibility-support-changed', listener: (event?: Event, + /** + * `true` when Chrome's accessibility support is enabled, `false` otherwise. + */ + accessibilitySupportEnabled?: boolean) => void): this; + addListener(event: 'accessibility-support-changed', listener: (event?: Event, + /** + * `true` when Chrome's accessibility support is enabled, `false` otherwise. + */ + accessibilitySupportEnabled?: boolean) => void): this; + removeListener(event: 'accessibility-support-changed', listener: (event?: Event, + /** + * `true` when Chrome's accessibility support is enabled, `false` otherwise. + */ + accessibilitySupportEnabled?: boolean) => void): this; /** * Emitted when the application is activated. Various actions can trigger this * event, such as launching the application for the first time, attempting to * re-launch the application when it's already running, or clicking on the * application's dock or taskbar icon. */ - on(event: 'activate', listener: (event: Event, - hasVisibleWindows: boolean) => void): this; + on(event: 'activate', listener: (event?: Event, + hasVisibleWindows?: boolean) => void): this; + once(event: 'activate', listener: (event?: Event, + hasVisibleWindows?: boolean) => void): this; + addListener(event: 'activate', listener: (event?: Event, + hasVisibleWindows?: boolean) => void): this; + removeListener(event: 'activate', listener: (event?: Event, + hasVisibleWindows?: boolean) => void): this; /** * Emitted before the application starts closing its windows. Calling * event.preventDefault() will prevent the default behaviour, which is terminating @@ -134,36 +172,84 @@ declare namespace Electron { * autoUpdater.quitAndInstall() then before-quit is emitted after emitting close * event on all windows and closing them. */ - on(event: 'before-quit', listener: (event: Event) => void): this; + on(event: 'before-quit', listener: (event?: Event) => void): this; + once(event: 'before-quit', listener: (event?: Event) => void): this; + addListener(event: 'before-quit', listener: (event?: Event) => void): this; + removeListener(event: 'before-quit', listener: (event?: Event) => void): this; /** * Emitted when a browserWindow gets blurred. */ - on(event: 'browser-window-blur', listener: (event: Event, - window: BrowserWindow) => void): this; + on(event: 'browser-window-blur', listener: (event?: Event, + window?: BrowserWindow) => void): this; + once(event: 'browser-window-blur', listener: (event?: Event, + window?: BrowserWindow) => void): this; + addListener(event: 'browser-window-blur', listener: (event?: Event, + window?: BrowserWindow) => void): this; + removeListener(event: 'browser-window-blur', listener: (event?: Event, + window?: BrowserWindow) => void): this; /** * Emitted when a new browserWindow is created. */ - on(event: 'browser-window-created', listener: (event: Event, - window: BrowserWindow) => void): this; + on(event: 'browser-window-created', listener: (event?: Event, + window?: BrowserWindow) => void): this; + once(event: 'browser-window-created', listener: (event?: Event, + window?: BrowserWindow) => void): this; + addListener(event: 'browser-window-created', listener: (event?: Event, + window?: BrowserWindow) => void): this; + removeListener(event: 'browser-window-created', listener: (event?: Event, + window?: BrowserWindow) => void): this; /** * Emitted when a browserWindow gets focused. */ - on(event: 'browser-window-focus', listener: (event: Event, - window: BrowserWindow) => void): this; + on(event: 'browser-window-focus', listener: (event?: Event, + window?: BrowserWindow) => void): this; + once(event: 'browser-window-focus', listener: (event?: Event, + window?: BrowserWindow) => void): this; + addListener(event: 'browser-window-focus', listener: (event?: Event, + window?: BrowserWindow) => void): this; + removeListener(event: 'browser-window-focus', listener: (event?: Event, + window?: BrowserWindow) => void): this; /** * Emitted when failed to verify the certificate for url, to trust the certificate * you should prevent the default behavior with event.preventDefault() and call * callback(true). */ - on(event: 'certificate-error', listener: (event: Event, - webContents: WebContents, - url: string, + on(event: 'certificate-error', listener: (event?: Event, + webContents?: WebContents, + url?: string, /** * The error code */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; + error?: string, + certificate?: Certificate, + callback?: (isTrusted?: boolean) => void) => void): this; + once(event: 'certificate-error', listener: (event?: Event, + webContents?: WebContents, + url?: string, + /** + * The error code + */ + error?: string, + certificate?: Certificate, + callback?: (isTrusted?: boolean) => void) => void): this; + addListener(event: 'certificate-error', listener: (event?: Event, + webContents?: WebContents, + url?: string, + /** + * The error code + */ + error?: string, + certificate?: Certificate, + callback?: (isTrusted?: boolean) => void) => void): this; + removeListener(event: 'certificate-error', listener: (event?: Event, + webContents?: WebContents, + url?: string, + /** + * The error code + */ + error?: string, + certificate?: Certificate, + callback?: (isTrusted?: boolean) => void) => void): this; /** * Emitted during Handoff when an activity from a different device wants to be * resumed. You should call event.preventDefault() if you want to handle this @@ -172,31 +258,79 @@ declare namespace Electron { * type. Supported activity types are specified in the app's Info.plist under the * NSUserActivityTypes key. */ - on(event: 'continue-activity', listener: (event: Event, + on(event: 'continue-activity', listener: (event?: Event, /** * A string identifying the activity. Maps to . */ - type: string, + type?: string, /** * Contains app-specific state stored by the activity on another device. */ - userInfo: any) => void): this; + userInfo?: any) => void): this; + once(event: 'continue-activity', listener: (event?: Event, + /** + * A string identifying the activity. Maps to . + */ + type?: string, + /** + * Contains app-specific state stored by the activity on another device. + */ + userInfo?: any) => void): this; + addListener(event: 'continue-activity', listener: (event?: Event, + /** + * A string identifying the activity. Maps to . + */ + type?: string, + /** + * Contains app-specific state stored by the activity on another device. + */ + userInfo?: any) => void): this; + removeListener(event: 'continue-activity', listener: (event?: Event, + /** + * A string identifying the activity. Maps to . + */ + type?: string, + /** + * Contains app-specific state stored by the activity on another device. + */ + userInfo?: any) => void): this; /** * Emitted when the gpu process crashes or is killed. */ - on(event: 'gpu-process-crashed', listener: (event: Event, - killed: boolean) => void): this; + on(event: 'gpu-process-crashed', listener: (event?: Event, + killed?: boolean) => void): this; + once(event: 'gpu-process-crashed', listener: (event?: Event, + killed?: boolean) => void): this; + addListener(event: 'gpu-process-crashed', listener: (event?: Event, + killed?: boolean) => void): this; + removeListener(event: 'gpu-process-crashed', listener: (event?: Event, + killed?: boolean) => void): this; /** * Emitted when webContents wants to do basic auth. The default behavior is to * cancel all authentications, to override this you should prevent the default * behavior with event.preventDefault() and call callback(username, password) with * the credentials. */ - on(event: 'login', listener: (event: Event, - webContents: WebContents, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; + on(event: 'login', listener: (event?: Event, + webContents?: WebContents, + request?: Request, + authInfo?: AuthInfo, + callback?: (username?: string, password?: string) => void) => void): this; + once(event: 'login', listener: (event?: Event, + webContents?: WebContents, + request?: Request, + authInfo?: AuthInfo, + callback?: (username?: string, password?: string) => void) => void): this; + addListener(event: 'login', listener: (event?: Event, + webContents?: WebContents, + request?: Request, + authInfo?: AuthInfo, + callback?: (username?: string, password?: string) => void) => void): this; + removeListener(event: 'login', listener: (event?: Event, + webContents?: WebContents, + request?: Request, + authInfo?: AuthInfo, + callback?: (username?: string, password?: string) => void) => void): this; /** * Emitted when the user wants to open a file with the application. The open-file * event is usually emitted when the application is already open and the OS wants @@ -207,44 +341,86 @@ declare namespace Electron { * event.preventDefault() if you want to handle this event. On Windows, you have to * parse process.argv (in the main process) to get the filepath. */ - on(event: 'open-file', listener: (event: Event, - path: string) => void): this; + on(event: 'open-file', listener: (event?: Event, + path?: string) => void): this; + once(event: 'open-file', listener: (event?: Event, + path?: string) => void): this; + addListener(event: 'open-file', listener: (event?: Event, + path?: string) => void): this; + removeListener(event: 'open-file', listener: (event?: Event, + path?: string) => void): this; /** * Emitted when the user wants to open a URL with the application. Your * application's Info.plist file must define the url scheme within the * CFBundleURLTypes key, and set NSPrincipalClass to AtomApplication. You should * call event.preventDefault() if you want to handle this event. */ - on(event: 'open-url', listener: (event: Event, - url: string) => void): this; + on(event: 'open-url', listener: (event?: Event, + url?: string) => void): this; + once(event: 'open-url', listener: (event?: Event, + url?: string) => void): this; + addListener(event: 'open-url', listener: (event?: Event, + url?: string) => void): this; + removeListener(event: 'open-url', listener: (event?: Event, + url?: string) => void): this; /** * Emitted when the application is quitting. */ - on(event: 'quit', listener: (event: Event, - exitCode: number) => void): this; + on(event: 'quit', listener: (event?: Event, + exitCode?: number) => void): this; + once(event: 'quit', listener: (event?: Event, + exitCode?: number) => void): this; + addListener(event: 'quit', listener: (event?: Event, + exitCode?: number) => void): this; + removeListener(event: 'quit', listener: (event?: Event, + exitCode?: number) => void): this; /** * Emitted when Electron has finished initializing. On macOS, launchInfo holds the * userInfo of the NSUserNotification that was used to open the application, if it * was launched from Notification Center. You can call app.isReady() to check if * this event has already fired. */ - on(event: 'ready', listener: (launchInfo: any) => void): this; + on(event: 'ready', listener: (launchInfo?: any) => void): this; + once(event: 'ready', listener: (launchInfo?: any) => void): this; + addListener(event: 'ready', listener: (launchInfo?: any) => void): this; + removeListener(event: 'ready', listener: (launchInfo?: any) => void): this; /** * Emitted when a client certificate is requested. The url corresponds to the * navigation entry requesting the client certificate and callback can be called * with an entry filtered from the list. Using event.preventDefault() prevents the * application from using the first certificate from the store. */ - on(event: 'select-client-certificate', listener: (event: Event, - webContents: WebContents, - url: URL, - certificateList: Certificate[], - callback: (certificate?: Certificate) => void) => void): this; + on(event: 'select-client-certificate', listener: (event?: Event, + webContents?: WebContents, + url?: string, + certificateList?: Certificate[], + callback?: (certificate?: Certificate) => void) => void): this; + once(event: 'select-client-certificate', listener: (event?: Event, + webContents?: WebContents, + url?: string, + certificateList?: Certificate[], + callback?: (certificate?: Certificate) => void) => void): this; + addListener(event: 'select-client-certificate', listener: (event?: Event, + webContents?: WebContents, + url?: string, + certificateList?: Certificate[], + callback?: (certificate?: Certificate) => void) => void): this; + removeListener(event: 'select-client-certificate', listener: (event?: Event, + webContents?: WebContents, + url?: string, + certificateList?: Certificate[], + callback?: (certificate?: Certificate) => void) => void): this; /** * Emitted when a new webContents is created. */ - on(event: 'web-contents-created', listener: (event: Event, - webContents: WebContents) => void): this; + on(event: 'web-contents-created', listener: (event?: Event, + webContents?: WebContents) => void): this; + once(event: 'web-contents-created', listener: (event?: Event, + webContents?: WebContents) => void): this; + addListener(event: 'web-contents-created', listener: (event?: Event, + webContents?: WebContents) => void): this; + removeListener(event: 'web-contents-created', listener: (event?: Event, + webContents?: WebContents) => void): this; /** * Emitted when the application has finished basic startup. On Windows and Linux, * the will-finish-launching event is the same as the ready event; on macOS, this @@ -254,13 +430,19 @@ declare namespace Electron { * should just do everything in the ready event handler. */ on(event: 'will-finish-launching', listener: Function): this; + once(event: 'will-finish-launching', listener: Function): this; + addListener(event: 'will-finish-launching', listener: Function): this; + removeListener(event: 'will-finish-launching', listener: Function): this; /** * Emitted when all windows have been closed and the application will quit. Calling * event.preventDefault() will prevent the default behaviour, which is terminating * the application. See the description of the window-all-closed event for the * differences between the will-quit and window-all-closed events. */ - on(event: 'will-quit', listener: (event: Event) => void): this; + on(event: 'will-quit', listener: (event?: Event) => void): this; + once(event: 'will-quit', listener: (event?: Event) => void): this; + addListener(event: 'will-quit', listener: (event?: Event) => void): this; + removeListener(event: 'will-quit', listener: (event?: Event) => void): this; /** * Emitted when all windows have been closed. If you do not subscribe to this event * and all windows are closed, the default behavior is to quit the app; however, if @@ -270,6 +452,9 @@ declare namespace Electron { * window-all-closed event would not be emitted. */ on(event: 'window-all-closed', listener: Function): this; + once(event: 'window-all-closed', listener: Function): this; + addListener(event: 'window-all-closed', listener: Function): this; + removeListener(event: 'window-all-closed', listener: Function): this; /** * Adds path to the recent documents list. This list is managed by the OS. On * Windows you can visit the list from the task bar, and on macOS you can visit it @@ -296,6 +481,11 @@ declare namespace Electron { * the active app. On Windows, focuses on the application's first window. */ focus(): void; + /** + * Returns ProcessMemoryInfo[]: Array of ProcessMemoryInfo objects that correspond + * to memory usage statistics of all the processes associated with the app. + */ + getAppMemoryInfo(): void; getAppPath(): string; getBadgeCount(): number; getCurrentActivityType(): string; @@ -303,12 +493,12 @@ declare namespace Electron { * Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux * and macOS, icons depend on the application associated with file mime type. */ - getFileIcon(path: string, callback: (error: Error, icon: NativeImage) => void): void; + getFileIcon(path: string, options: FileIconOptions, callback: (error?: Error, icon?: NativeImage) => void): void; /** * Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux * and macOS, icons depend on the application associated with file mime type. */ - getFileIcon(path: string, options: FileIconOptions, callback: (error: Error, icon: NativeImage) => void): void; + getFileIcon(path: string, callback: (error?: Error, icon?: NativeImage) => void): void; getJumpListSettings(): JumpListSettings; /** * Note: When distributing your packaged app, you have to also ship the locales @@ -344,7 +534,7 @@ declare namespace Electron { * success while any other value indicates failure according to chromium * net_error_list. */ - importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void; + importCertificate(options: ImportCertificateOptions, callback: (result?: number) => void): void; isAccessibilitySupportEnabled(): boolean; /** * This method checks if the current executable is the default handler for a @@ -377,7 +567,7 @@ declare namespace Electron { * and you have to use this method to ensure single instance. An example of * activating the window of primary instance when a second instance starts: */ - makeSingleInstance(callback: (argv: string[], workingDirectory: string) => void): void; + makeSingleInstance(callback: (argv?: string[], workingDirectory?: string) => void): void; /** * Try to close all windows. The before-quit event will be emitted first. If all * windows are successfully closed, the will-quit event will be emitted and by @@ -494,8 +684,8 @@ declare namespace Electron { * them. */ show(): void; - commandLine: CommandLine; - dock: Dock; + commandLine?: CommandLine; + dock?: Dock; } interface AutoUpdater extends EventEmitter { @@ -506,28 +696,55 @@ declare namespace Electron { * Emitted when checking if an update has started. */ on(event: 'checking-for-update', listener: Function): this; + once(event: 'checking-for-update', listener: Function): this; + addListener(event: 'checking-for-update', listener: Function): this; + removeListener(event: 'checking-for-update', listener: Function): this; /** * Emitted when there is an error while updating. */ - on(event: 'error', listener: (error: Error) => void): this; + on(event: 'error', listener: (error?: Error) => void): this; + once(event: 'error', listener: (error?: Error) => void): this; + addListener(event: 'error', listener: (error?: Error) => void): this; + removeListener(event: 'error', listener: (error?: Error) => void): this; /** * Emitted when there is an available update. The update is downloaded * automatically. */ on(event: 'update-available', listener: Function): this; + once(event: 'update-available', listener: Function): this; + addListener(event: 'update-available', listener: Function): this; + removeListener(event: 'update-available', listener: Function): this; /** * Emitted when an update has been downloaded. On Windows only releaseName is * available. */ - on(event: 'update-downloaded', listener: (event: Event, - releaseNotes: string, - releaseName: string, - releaseDate: Date, - updateURL: string) => void): this; + on(event: 'update-downloaded', listener: (event?: Event, + releaseNotes?: string, + releaseName?: string, + releaseDate?: Date, + updateURL?: string) => void): this; + once(event: 'update-downloaded', listener: (event?: Event, + releaseNotes?: string, + releaseName?: string, + releaseDate?: Date, + updateURL?: string) => void): this; + addListener(event: 'update-downloaded', listener: (event?: Event, + releaseNotes?: string, + releaseName?: string, + releaseDate?: Date, + updateURL?: string) => void): this; + removeListener(event: 'update-downloaded', listener: (event?: Event, + releaseNotes?: string, + releaseName?: string, + releaseDate?: Date, + updateURL?: string) => void): this; /** * Emitted when there is no available update. */ on(event: 'update-not-available', listener: Function): this; + once(event: 'update-not-available', listener: Function): this; + addListener(event: 'update-not-available', listener: Function): this; + removeListener(event: 'update-not-available', listener: Function): this; /** * Asks the server whether there is an update. You must call setFeedURL before * using this API. @@ -548,12 +765,27 @@ declare namespace Electron { setFeedURL(url: string, requestHeaders?: any): void; } - type BluetoothDevice = { + interface BluetoothDevice { // Docs: http://electron.atom.io/docs/api/structures/bluetooth-device - deviceId: string; - deviceName: string; + deviceId?: string; + deviceName?: string; + } + + class BrowserView extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/browser-view + + constructor(options?: BrowserViewConstructorOptions); + setAutoResize(options: AutoResizeOptions): void; + setBackgroundColor(color?: string): void; + /** + * Resizes and moves the view to the supplied bounds relative to the window. + */ + setBounds(bounds: Rectangle): void; + id: number; + webContents: webContents; } class BrowserWindow extends EventEmitter { @@ -567,12 +799,21 @@ declare namespace Electron { * and the APPCOMMAND_ prefix is stripped off. e.g. APPCOMMAND_BROWSER_BACKWARD is * emitted as browser-backward. */ - on(event: 'app-command', listener: (event: Event, - command: string) => void): this; + on(event: 'app-command', listener: (event?: Event, + command?: string) => void): this; + once(event: 'app-command', listener: (event?: Event, + command?: string) => void): this; + addListener(event: 'app-command', listener: (event?: Event, + command?: string) => void): this; + removeListener(event: 'app-command', listener: (event?: Event, + command?: string) => void): this; /** * Emitted when the window loses focus. */ on(event: 'blur', listener: Function): this; + once(event: 'blur', listener: Function): this; + addListener(event: 'blur', listener: Function): this; + removeListener(event: 'blur', listener: Function): this; /** * Emitted when the window is going to be closed. It's emitted before the * beforeunload and unload event of the DOM. Calling event.preventDefault() will @@ -581,105 +822,205 @@ declare namespace Electron { * window is reloaded. In Electron, returning any value other than undefined would * cancel the close. For example: */ - on(event: 'close', listener: (event: Event) => void): this; + on(event: 'close', listener: (event?: Event) => void): this; + once(event: 'close', listener: (event?: Event) => void): this; + addListener(event: 'close', listener: (event?: Event) => void): this; + removeListener(event: 'close', listener: (event?: Event) => void): this; /** * Emitted when the window is closed. After you have received this event you should * remove the reference to the window and avoid using it any more. */ on(event: 'closed', listener: Function): this; + once(event: 'closed', listener: Function): this; + addListener(event: 'closed', listener: Function): this; + removeListener(event: 'closed', listener: Function): this; /** * Emitted when the window enters a full-screen state. */ on(event: 'enter-full-screen', listener: Function): this; + once(event: 'enter-full-screen', listener: Function): this; + addListener(event: 'enter-full-screen', listener: Function): this; + removeListener(event: 'enter-full-screen', listener: Function): this; /** * Emitted when the window enters a full-screen state triggered by HTML API. */ on(event: 'enter-html-full-screen', listener: Function): this; + once(event: 'enter-html-full-screen', listener: Function): this; + addListener(event: 'enter-html-full-screen', listener: Function): this; + removeListener(event: 'enter-html-full-screen', listener: Function): this; /** * Emitted when the window gains focus. */ on(event: 'focus', listener: Function): this; + once(event: 'focus', listener: Function): this; + addListener(event: 'focus', listener: Function): this; + removeListener(event: 'focus', listener: Function): this; /** * Emitted when the window is hidden. */ on(event: 'hide', listener: Function): this; + once(event: 'hide', listener: Function): this; + addListener(event: 'hide', listener: Function): this; + removeListener(event: 'hide', listener: Function): this; /** * Emitted when the window leaves a full-screen state. */ on(event: 'leave-full-screen', listener: Function): this; + once(event: 'leave-full-screen', listener: Function): this; + addListener(event: 'leave-full-screen', listener: Function): this; + removeListener(event: 'leave-full-screen', listener: Function): this; /** * Emitted when the window leaves a full-screen state triggered by HTML API. */ on(event: 'leave-html-full-screen', listener: Function): this; + once(event: 'leave-html-full-screen', listener: Function): this; + addListener(event: 'leave-html-full-screen', listener: Function): this; + removeListener(event: 'leave-html-full-screen', listener: Function): this; /** * Emitted when window is maximized. */ on(event: 'maximize', listener: Function): this; + once(event: 'maximize', listener: Function): this; + addListener(event: 'maximize', listener: Function): this; + removeListener(event: 'maximize', listener: Function): this; /** * Emitted when the window is minimized. */ on(event: 'minimize', listener: Function): this; + once(event: 'minimize', listener: Function): this; + addListener(event: 'minimize', listener: Function): this; + removeListener(event: 'minimize', listener: Function): this; /** * Emitted when the window is being moved to a new position. Note: On macOS this * event is just an alias of moved. */ on(event: 'move', listener: Function): this; + once(event: 'move', listener: Function): this; + addListener(event: 'move', listener: Function): this; + removeListener(event: 'move', listener: Function): this; /** * Emitted once when the window is moved to a new position. */ on(event: 'moved', listener: Function): this; + once(event: 'moved', listener: Function): this; + addListener(event: 'moved', listener: Function): this; + removeListener(event: 'moved', listener: Function): this; /** * Emitted when the document changed its title, calling event.preventDefault() will * prevent the native window's title from changing. */ - on(event: 'page-title-updated', listener: (event: Event, - title: string) => void): this; + on(event: 'page-title-updated', listener: (event?: Event, + title?: string) => void): this; + once(event: 'page-title-updated', listener: (event?: Event, + title?: string) => void): this; + addListener(event: 'page-title-updated', listener: (event?: Event, + title?: string) => void): this; + removeListener(event: 'page-title-updated', listener: (event?: Event, + title?: string) => void): this; /** * Emitted when the web page has been rendered (while not being shown) and window * can be displayed without a visual flash. */ on(event: 'ready-to-show', listener: Function): this; + once(event: 'ready-to-show', listener: Function): this; + addListener(event: 'ready-to-show', listener: Function): this; + removeListener(event: 'ready-to-show', listener: Function): this; /** * Emitted when the window is being resized. */ on(event: 'resize', listener: Function): this; + once(event: 'resize', listener: Function): this; + addListener(event: 'resize', listener: Function): this; + removeListener(event: 'resize', listener: Function): this; /** * Emitted when the unresponsive web page becomes responsive again. */ on(event: 'responsive', listener: Function): this; + once(event: 'responsive', listener: Function): this; + addListener(event: 'responsive', listener: Function): this; + removeListener(event: 'responsive', listener: Function): this; /** * Emitted when the window is restored from a minimized state. */ on(event: 'restore', listener: Function): this; + once(event: 'restore', listener: Function): this; + addListener(event: 'restore', listener: Function): this; + removeListener(event: 'restore', listener: Function): this; /** * Emitted when scroll wheel event phase has begun. */ on(event: 'scroll-touch-begin', listener: Function): this; + once(event: 'scroll-touch-begin', listener: Function): this; + addListener(event: 'scroll-touch-begin', listener: Function): this; + removeListener(event: 'scroll-touch-begin', listener: Function): this; /** * Emitted when scroll wheel event phase filed upon reaching the edge of element. */ on(event: 'scroll-touch-edge', listener: Function): this; + once(event: 'scroll-touch-edge', listener: Function): this; + addListener(event: 'scroll-touch-edge', listener: Function): this; + removeListener(event: 'scroll-touch-edge', listener: Function): this; /** * Emitted when scroll wheel event phase has ended. */ on(event: 'scroll-touch-end', listener: Function): this; + once(event: 'scroll-touch-end', listener: Function): this; + addListener(event: 'scroll-touch-end', listener: Function): this; + removeListener(event: 'scroll-touch-end', listener: Function): this; + /** + * Emitted when window session is going to end due to force shutdown or machine + * restart or session log off. + */ + on(event: 'session-end', listener: Function): this; + once(event: 'session-end', listener: Function): this; + addListener(event: 'session-end', listener: Function): this; + removeListener(event: 'session-end', listener: Function): this; + /** + * Emitted when the window opens a sheet. + */ + on(event: 'sheet-begin', listener: Function): this; + once(event: 'sheet-begin', listener: Function): this; + addListener(event: 'sheet-begin', listener: Function): this; + removeListener(event: 'sheet-begin', listener: Function): this; + /** + * Emitted when the window has closed a sheet. + */ + on(event: 'sheet-end', listener: Function): this; + once(event: 'sheet-end', listener: Function): this; + addListener(event: 'sheet-end', listener: Function): this; + removeListener(event: 'sheet-end', listener: Function): this; /** * Emitted when the window is shown. */ on(event: 'show', listener: Function): this; + once(event: 'show', listener: Function): this; + addListener(event: 'show', listener: Function): this; + removeListener(event: 'show', listener: Function): this; /** * Emitted on 3-finger swipe. Possible directions are up, right, down, left. */ - on(event: 'swipe', listener: (event: Event, - direction: string) => void): this; + on(event: 'swipe', listener: (event?: Event, + direction?: string) => void): this; + once(event: 'swipe', listener: (event?: Event, + direction?: string) => void): this; + addListener(event: 'swipe', listener: (event?: Event, + direction?: string) => void): this; + removeListener(event: 'swipe', listener: (event?: Event, + direction?: string) => void): this; /** * Emitted when the window exits from a maximized state. */ on(event: 'unmaximize', listener: Function): this; + once(event: 'unmaximize', listener: Function): this; + addListener(event: 'unmaximize', listener: Function): this; + removeListener(event: 'unmaximize', listener: Function): this; /** * Emitted when the web page becomes unresponsive. */ on(event: 'unresponsive', listener: Function): this; + once(event: 'unresponsive', listener: Function): this; + addListener(event: 'unresponsive', listener: Function): this; + removeListener(event: 'unresponsive', listener: Function): this; constructor(options?: BrowserWindowConstructorOptions); /** * Adds DevTools extension located at path, and returns extension's name. The @@ -713,11 +1054,11 @@ declare namespace Electron { /** * Same as webContents.capturePage([rect, ]callback). */ - capturePage(callback: (image: NativeImage) => void): void; + capturePage(callback: (image?: NativeImage) => void): void; /** * Same as webContents.capturePage([rect, ]callback). */ - capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; + capturePage(rect: Rectangle, callback: (image?: NativeImage) => void): void; /** * Moves window to the center of the screen. */ @@ -871,7 +1212,7 @@ declare namespace Electron { * Just sum any extra width and height areas you have within the overall content * view. */ - setAspectRatio(aspectRatio: number, extraSize?: ExtraSize): void; + setAspectRatio(aspectRatio: number, extraSize: Size): void; /** * Controls whether to hide cursor when typing. */ @@ -886,6 +1227,11 @@ declare namespace Electron { * Resizes and moves the window to the supplied bounds */ setBounds(bounds: Rectangle, animate?: boolean): void; + /** + * Note: The BrowserView API is currently experimental and may change or be removed + * in future Electron releases. + */ + setBrowserView(browserView: BrowserView): void; /** * Sets whether the window can be manually closed by user. On Linux does nothing. */ @@ -1125,20 +1471,80 @@ declare namespace Electron { closed: boolean; } - type Certificate = { + interface Certificate { // Docs: http://electron.atom.io/docs/api/structures/certificate - data: string; - fingerprint: string; - issuer: CertificatePrincipal; - issuerCert: Certificate; - issuerName: string; - serialNumber: string; - subject: CertificatePrincipal; - subjectName: string; - validExpiry: number; - validStart: number; + /** + * PEM encoded data + */ + data?: string; + /** + * Fingerprint of the certificate + */ + fingerprint?: string; + /** + * Issuer principal + */ + issuer?: CertificatePrincipal; + /** + * Issuer certificate (if not self-signed) + */ + issuerCert?: Certificate; + /** + * Issuer's Common Name + */ + issuerName?: string; + /** + * Hex value represented string + */ + serialNumber?: string; + /** + * Subject principal + */ + subject?: CertificatePrincipal; + /** + * Subject's Common Name + */ + subjectName?: string; + /** + * End date of the certificate being valid in seconds + */ + validExpiry?: number; + /** + * Start date of the certificate being valid in seconds + */ + validStart?: number; + } + + interface CertificatePrincipal { + + // Docs: http://electron.atom.io/docs/api/structures/certificate-principal + + /** + * Common Name + */ + commonName?: string; + /** + * Country or region + */ + country?: string; + /** + * Locality + */ + locality?: string; + /** + * Organization names + */ + organizations?: string[]; + /** + * Organization Unit names + */ + organizationUnits?: string[]; + /** + * State or province + */ + state?: string; } class ClientRequest extends EventEmitter { @@ -1150,38 +1556,105 @@ declare namespace Electron { * request is already closed. */ on(event: 'abort', listener: Function): this; + once(event: 'abort', listener: Function): this; + addListener(event: 'abort', listener: Function): this; + removeListener(event: 'abort', listener: Function): this; /** * Emitted as the last event in the HTTP request-response transaction. The close * event indicates that no more events will be emitted on either the request or * response objects. */ on(event: 'close', listener: Function): this; + once(event: 'close', listener: Function): this; + addListener(event: 'close', listener: Function): this; + removeListener(event: 'close', listener: Function): this; /** * Emitted when the net module fails to issue a network request. Typically when the * request object emits an error event, a close event will subsequently follow and * no response object will be provided. */ - on(event: 'error', listener: (/** + on(event: 'error', listener: ( + /** * an error object providing some information about the failure. */ - error: Error) => void): this; + error?: Error) => void): this; + once(event: 'error', listener: ( + /** + * an error object providing some information about the failure. + */ + error?: Error) => void): this; + addListener(event: 'error', listener: ( + /** + * an error object providing some information about the failure. + */ + error?: Error) => void): this; + removeListener(event: 'error', listener: ( + /** + * an error object providing some information about the failure. + */ + error?: Error) => void): this; /** * Emitted just after the last chunk of the request's data has been written into * the request object. */ on(event: 'finish', listener: Function): this; + once(event: 'finish', listener: Function): this; + addListener(event: 'finish', listener: Function): this; + removeListener(event: 'finish', listener: Function): this; /** * Emitted when an authenticating proxy is asking for user credentials. The * callback function is expected to be called back with user credentials: Providing * empty credentials will cancel the request and report an authentication error on * the response object: */ - on(event: 'login', listener: (authInfo: AuthInfo, - callback: () => void) => void): this; - on(event: 'response', listener: (/** + on(event: 'login', listener: (authInfo?: AuthInfo, + callback?: (username?: string, password?: string) => void) => void): this; + once(event: 'login', listener: (authInfo?: AuthInfo, + callback?: (username?: string, password?: string) => void) => void): this; + addListener(event: 'login', listener: (authInfo?: AuthInfo, + callback?: (username?: string, password?: string) => void) => void): this; + removeListener(event: 'login', listener: (authInfo?: AuthInfo, + callback?: (username?: string, password?: string) => void) => void): this; + /** + * Emitted when there is redirection and the mode is manual. Calling + * request.followRedirect will continue with the redirection. + */ + on(event: 'redirect', listener: (statusCode?: number, + method?: string, + redirectUrl?: string, + responseHeaders?: any) => void): this; + once(event: 'redirect', listener: (statusCode?: number, + method?: string, + redirectUrl?: string, + responseHeaders?: any) => void): this; + addListener(event: 'redirect', listener: (statusCode?: number, + method?: string, + redirectUrl?: string, + responseHeaders?: any) => void): this; + removeListener(event: 'redirect', listener: (statusCode?: number, + method?: string, + redirectUrl?: string, + responseHeaders?: any) => void): this; + on(event: 'response', listener: ( + /** * An object representing the HTTP response message. */ - response: IncomingMessage) => void): this; + response?: IncomingMessage) => void): this; + once(event: 'response', listener: ( + /** + * An object representing the HTTP response message. + */ + response?: IncomingMessage) => void): this; + addListener(event: 'response', listener: ( + /** + * An object representing the HTTP response message. + */ + response?: IncomingMessage) => void): this; + removeListener(event: 'response', listener: ( + /** + * An object representing the HTTP response message. + */ + response?: IncomingMessage) => void): this; constructor(options: any | string); /** * Cancels an ongoing HTTP transaction. If the request has already emitted the @@ -1196,7 +1669,11 @@ declare namespace Electron { */ end(chunk?: string | Buffer, encoding?: string, callback?: Function): void; /** - * Returns String - The value of a previously set extra header name. + * Continues any deferred redirection request when the redirection mode is manual. + */ + followRedirect(): void; + /** + * Returns Object - The value of a previously set extra header name. */ getHeader(name: string): void; /** @@ -1207,9 +1684,10 @@ declare namespace Electron { /** * Adds an extra HTTP header. The header name will issued as it is without * lowercasing. It can be called only before first write. Calling this method after - * the first write will throw an error. + * the first write will throw an error. If the passed value is not a String, its + * toString() method will be called to obtain the final value. */ - setHeader(name: string, value: string): void; + setHeader(name: string, value: any): void; /** * callback is essentially a dummy function introduced in the purpose of keeping * similarity with the Node.js API. It is called asynchronously in the next tick @@ -1293,19 +1771,19 @@ declare namespace Electron { * Once all child processes have acknowledged the captureMonitoringSnapshot request * the callback will be called with a file that contains the traced data. */ - captureMonitoringSnapshot(resultFilePath: string, callback: (resultFilePath: string) => void): void; + captureMonitoringSnapshot(resultFilePath: string, callback: (resultFilePath?: string) => void): void; /** * Get a set of category groups. The category groups can change as new code paths * are reached. Once all child processes have acknowledged the getCategories * request the callback is invoked with an array of category groups. */ - getCategories(callback: (categories: string[]) => void): void; + getCategories(callback: (categories?: string[]) => void): void; /** * Get the maximum usage across processes of trace buffer as a percentage of the * full state. When the TraceBufferUsage value is determined the callback is * called. */ - getTraceBufferUsage(callback: (value: number, percentage: number) => void): void; + getTraceBufferUsage(callback: (value?: number, percentage?: number) => void): void; /** * Start monitoring on all processes. Monitoring begins immediately locally and * asynchronously on child processes as soon as they receive the startMonitoring @@ -1347,22 +1825,51 @@ declare namespace Electron { * is not empty or into a temporary file. The actual file path will be passed to * callback if it's not null. */ - stopRecording(resultFilePath: string, callback: (resultFilePath: string) => void): void; + stopRecording(resultFilePath: string, callback: (resultFilePath?: string) => void): void; } - type Cookie = { + interface Cookie { // Docs: http://electron.atom.io/docs/api/structures/cookie + /** + * The domain of the cookie. + */ domain?: string; + /** + * The expiration date of the cookie as the number of seconds since the UNIX epoch. + * Not provided for session cookies. + */ expirationDate?: number; + /** + * Whether the cookie is a host-only cookie. + */ hostOnly?: boolean; + /** + * Whether the cookie is marked as HTTP only. + */ httpOnly?: boolean; - name: string; + /** + * The name of the cookie. + */ + name?: string; + /** + * The path of the cookie. + */ path?: string; + /** + * Whether the cookie is marked as secure. + */ secure?: boolean; + /** + * Whether the cookie is a session cookie or a persistent cookie with an expiration + * date. + */ session?: boolean; - value: string; + /** + * The value of the cookie. + */ + value?: string; } class Cookies extends EventEmitter { @@ -1373,25 +1880,68 @@ declare namespace Electron { * Emitted when a cookie is changed because it was added, edited, removed, or * expired. */ - on(event: 'changed', listener: (event: Event, + on(event: 'changed', listener: (event?: Event, /** * The cookie that was changed */ - cookie: Cookie, + cookie?: Cookie, /** * The cause of the change with one of the following values: */ - cause: string, + cause?: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), /** * `true` if the cookie was removed, `false` otherwise. */ - removed: boolean) => void): this; + removed?: boolean) => void): this; + once(event: 'changed', listener: (event?: Event, + /** + * The cookie that was changed + */ + cookie?: Cookie, + /** + * The cause of the change with one of the following values: + */ + cause?: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), + /** + * `true` if the cookie was removed, `false` otherwise. + */ + removed?: boolean) => void): this; + addListener(event: 'changed', listener: (event?: Event, + /** + * The cookie that was changed + */ + cookie?: Cookie, + /** + * The cause of the change with one of the following values: + */ + cause?: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), + /** + * `true` if the cookie was removed, `false` otherwise. + */ + removed?: boolean) => void): this; + removeListener(event: 'changed', listener: (event?: Event, + /** + * The cookie that was changed + */ + cookie?: Cookie, + /** + * The cause of the change with one of the following values: + */ + cause?: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), + /** + * `true` if the cookie was removed, `false` otherwise. + */ + removed?: boolean) => void): this; + /** + * Writes any unwritten cookies data to disk. + */ + flushStore(callback: Function): void; /** * Sends a request to get all cookies matching details, callback will be called * with callback(error, cookies) on complete. cookies is an Array of cookie * objects. */ - get(filter: Filter, callback: (error: Error, cookies: Cookies[]) => void): void; + get(filter: Filter, callback: (error?: Error, cookies?: Cookies[]) => void): void; /** * Removes the cookies matching url and name, callback will called with callback() * on complete. @@ -1401,15 +1951,30 @@ declare namespace Electron { * Sets a cookie with details, callback will be called with callback(error) on * complete. */ - set(details: Details, callback: (error: Error) => void): void; + set(details: Details, callback: (error?: Error) => void): void; } - type CrashReport = { + interface CPUUsage { + + // Docs: http://electron.atom.io/docs/api/structures/cpu-usage + + /** + * The number of average idle cpu wakeups per second since the last call to + * getCPUUsage. First call returns 0. + */ + idleWakeupsPerSecond?: number; + /** + * Percentage of CPU used since the last call to getCPUUsage. First call returns 0. + */ + percentCPUUsage?: number; + } + + interface CrashReport { // Docs: http://electron.atom.io/docs/api/structures/crash-report - date: string; - ID: number; + date?: string; + ID?: number; } interface CrashReporter extends EventEmitter { @@ -1479,24 +2044,69 @@ declare namespace Electron { * Emitted when debugging session is terminated. This happens either when * webContents is closed or devtools is invoked for the attached webContents. */ - on(event: 'detach', listener: (event: Event, + on(event: 'detach', listener: (event?: Event, /** * Reason for detaching debugger. */ - reason: string) => void): this; + reason?: string) => void): this; + once(event: 'detach', listener: (event?: Event, + /** + * Reason for detaching debugger. + */ + reason?: string) => void): this; + addListener(event: 'detach', listener: (event?: Event, + /** + * Reason for detaching debugger. + */ + reason?: string) => void): this; + removeListener(event: 'detach', listener: (event?: Event, + /** + * Reason for detaching debugger. + */ + reason?: string) => void): this; /** * Emitted whenever debugging target issues instrumentation event. */ - on(event: 'message', listener: (event: Event, + on(event: 'message', listener: (event?: Event, /** * Method name. */ - method: string, + method?: string, /** * Event parameters defined by the 'parameters' attribute in the remote debugging * protocol. */ - params: any) => void): this; + params?: any) => void): this; + once(event: 'message', listener: (event?: Event, + /** + * Method name. + */ + method?: string, + /** + * Event parameters defined by the 'parameters' attribute in the remote debugging + * protocol. + */ + params?: any) => void): this; + addListener(event: 'message', listener: (event?: Event, + /** + * Method name. + */ + method?: string, + /** + * Event parameters defined by the 'parameters' attribute in the remote debugging + * protocol. + */ + params?: any) => void): this; + removeListener(event: 'message', listener: (event?: Event, + /** + * Method name. + */ + method?: string, + /** + * Event parameters defined by the 'parameters' attribute in the remote debugging + * protocol. + */ + params?: any) => void): this; /** * Attaches the debugger to the webContents. */ @@ -1509,7 +2119,7 @@ declare namespace Electron { /** * Send given command to the debugging target. */ - sendCommand(method: string, commandParams?: any, callback?: (error: any, result: any) => void): void; + sendCommand(method: string, commandParams?: any, callback?: (error?: any, result?: any) => void): void; } interface DesktopCapturer extends EventEmitter { @@ -1522,22 +2132,60 @@ declare namespace Electron { * DesktopCapturerSource objects, each DesktopCapturerSource represents a screen or * an individual window that can be captured. */ - getSources(options: SourcesOptions, callback: (error: Error, sources: DesktopCapturerSource[]) => void): void; + getSources(options: SourcesOptions, callback: (error?: Error, sources?: DesktopCapturerSource[]) => void): void; } - type DesktopCapturerSource = { + interface DesktopCapturerSource { // Docs: http://electron.atom.io/docs/api/structures/desktop-capturer-source - id: string; - name: string; - thumbnail: NativeImage; + /** + * The identifier of a window or screen that can be used as a constraint when + * calling []. The format of the identifier will be or , where is a random + * generated number. + */ + id?: string; + /** + * A screen source will be named either or , while the name of a window source will + * match the window title. + */ + name?: string; + /** + * A thumbnail image. There is no guarantee that the size of the thumbnail is the + * same as the specified in the passed to . The actual size depends on the scale of + * the screen or window. + */ + thumbnail?: NativeImage; } interface Dialog extends EventEmitter { // Docs: http://electron.atom.io/docs/api/dialog + /** + * On macOS, this displays a modal dialog that shows a message and certificate + * information, and gives the user the option of trusting/importing the + * certificate. If you provide a browserWindow argument the dialog will be attached + * to the parent window, making it modal. On Windows the options are more limited, + * due to the Win32 APIs used: + */ + showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions, callback: Function): void; + /** + * On macOS, this displays a modal dialog that shows a message and certificate + * information, and gives the user the option of trusting/importing the + * certificate. If you provide a browserWindow argument the dialog will be attached + * to the parent window, making it modal. On Windows the options are more limited, + * due to the Win32 APIs used: + */ + showCertificateTrustDialog(options: CertificateTrustDialogOptions, callback: Function): void; + /** + * On macOS, this displays a modal dialog that shows a message and certificate + * information, and gives the user the option of trusting/importing the + * certificate. If you provide a browserWindow argument the dialog will be attached + * to the parent window, making it modal. On Windows the options are more limited, + * due to the Win32 APIs used: + */ + showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions, callback: Function): void; /** * Displays a modal dialog that shows an error message. This API can be called * safely before the ready event the app module emits, it is usually used to report @@ -1552,7 +2200,7 @@ declare namespace Electron { * is passed, the API call will be asynchronous and the result will be passed via * callback(response). */ - showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions, callback?: (response: number, checkboxChecked: boolean) => void): number; + showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions, callback?: (response?: number, checkboxChecked?: boolean) => void): number; /** * Shows a message box, it will block the process until the message box is closed. * It returns the index of the clicked button. The browserWindow argument allows @@ -1560,7 +2208,7 @@ declare namespace Electron { * is passed, the API call will be asynchronous and the result will be passed via * callback(response). */ - showMessageBox(options: MessageBoxOptions, callback?: (response: number, checkboxChecked: boolean) => void): number; + showMessageBox(options: MessageBoxOptions, callback?: (response?: number, checkboxChecked?: boolean) => void): number; /** * The browserWindow argument allows the dialog to attach itself to a parent * window, making it modal. The filters specifies an array of file types that can @@ -1573,7 +2221,7 @@ declare namespace Electron { * file selector and a directory selector, so if you set properties to ['openFile', * 'openDirectory'] on these platforms, a directory selector will be shown. */ - showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions, callback?: (filePaths: string[]) => void): string[]; + showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions, callback?: (filePaths?: string[]) => void): string[]; /** * The browserWindow argument allows the dialog to attach itself to a parent * window, making it modal. The filters specifies an array of file types that can @@ -1586,7 +2234,7 @@ declare namespace Electron { * file selector and a directory selector, so if you set properties to ['openFile', * 'openDirectory'] on these platforms, a directory selector will be shown. */ - showOpenDialog(options: OpenDialogOptions, callback?: (filePaths: string[]) => void): string[]; + showOpenDialog(options: OpenDialogOptions, callback?: (filePaths?: string[]) => void): string[]; /** * The browserWindow argument allows the dialog to attach itself to a parent * window, making it modal. The filters specifies an array of file types that can @@ -1594,7 +2242,7 @@ declare namespace Electron { * the API call will be asynchronous and the result will be passed via * callback(filename) */ - showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions, callback?: (filename: string) => void): string; + showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions, callback?: (filename?: string) => void): string; /** * The browserWindow argument allows the dialog to attach itself to a parent * window, making it modal. The filters specifies an array of file types that can @@ -1602,21 +2250,33 @@ declare namespace Electron { * the API call will be asynchronous and the result will be passed via * callback(filename) */ - showSaveDialog(options: SaveDialogOptions, callback?: (filename: string) => void): string; + showSaveDialog(options: SaveDialogOptions, callback?: (filename?: string) => void): string; } - type Display = { + interface Display { // Docs: http://electron.atom.io/docs/api/structures/display - bounds: Rectangle; - id: number; - rotation: number; - scaleFactor: number; - size: Size; - touchSupport: string; - workArea: Rectangle; - workAreaSize: WorkAreaSize; + bounds?: Rectangle; + /** + * Unique identifier associated with the display. + */ + id?: number; + /** + * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees. + */ + rotation?: number; + /** + * Output device's pixel scale factor. + */ + scaleFactor?: number; + size?: Size; + /** + * Can be , , . + */ + touchSupport?: ('available' | 'unavailable' | 'unknown'); + workArea?: Rectangle; + workAreaSize?: Size; } class DownloadItem extends EventEmitter { @@ -1628,14 +2288,26 @@ declare namespace Electron { * download, a cancelled download (via downloadItem.cancel()), and interrupted * download that can't be resumed. The state can be one of following: */ - on(event: 'done', listener: (event: Event, - state: string) => void): this; + on(event: 'done', listener: (event?: Event, + state?: string) => void): this; + once(event: 'done', listener: (event?: Event, + state?: string) => void): this; + addListener(event: 'done', listener: (event?: Event, + state?: string) => void): this; + removeListener(event: 'done', listener: (event?: Event, + state?: string) => void): this; /** * Emitted when the download has been updated and is not done. The state can be one * of following: */ - on(event: 'updated', listener: (event: Event, - state: string) => void): this; + on(event: 'updated', listener: (event?: Event, + state?: string) => void): this; + once(event: 'updated', listener: (event?: Event, + state?: string) => void): this; + addListener(event: 'updated', listener: (event?: Event, + state?: string) => void): this; + removeListener(event: 'updated', listener: (event?: Event, + state?: string) => void): this; /** * Cancels the download operation. */ @@ -1675,7 +2347,10 @@ declare namespace Electron { */ pause(): void; /** - * Resumes the download that has been paused. + * Resumes the download that has been paused. Note: To enable resumable downloads + * the server you are downloading from must support range requests and provide both + * Last-Modified and ETag header values. Otherwise resume() will dismiss previously + * received bytes and restart the download from the beginning. */ resume(): void; /** @@ -1686,12 +2361,12 @@ declare namespace Electron { setSavePath(path: string): void; } - type FileFilter = { + interface FileFilter { // Docs: http://electron.atom.io/docs/api/structures/file-filter - extensions: string[]; - name: string; + extensions?: string[]; + name?: string; } interface GlobalShortcut extends EventEmitter { @@ -1730,18 +2405,40 @@ declare namespace Electron { * Emitted when a request has been canceled during an ongoing HTTP transaction. */ on(event: 'aborted', listener: Function): this; + once(event: 'aborted', listener: Function): this; + addListener(event: 'aborted', listener: Function): this; + removeListener(event: 'aborted', listener: Function): this; /** * The data event is the usual method of transferring response data into * applicative code. */ - on(event: 'data', listener: (/** + on(event: 'data', listener: ( + /** * A chunk of response body's data. */ - chunk: Buffer) => void): this; + chunk?: Buffer) => void): this; + once(event: 'data', listener: ( + /** + * A chunk of response body's data. + */ + chunk?: Buffer) => void): this; + addListener(event: 'data', listener: ( + /** + * A chunk of response body's data. + */ + chunk?: Buffer) => void): this; + removeListener(event: 'data', listener: ( + /** + * A chunk of response body's data. + */ + chunk?: Buffer) => void): this; /** * Indicates that response body has ended. */ on(event: 'end', listener: Function): this; + once(event: 'end', listener: Function): this; + addListener(event: 'end', listener: Function): this; + removeListener(event: 'end', listener: Function): this; /** * error Error - Typically holds an error string identifying failure root cause. * Emitted when an error was encountered while streaming response data events. For @@ -1750,6 +2447,9 @@ declare namespace Electron { * event will subsequently follow on the request object. */ on(event: 'error', listener: Function): this; + once(event: 'error', listener: Function): this; + addListener(event: 'error', listener: Function): this; + removeListener(event: 'error', listener: Function): this; headers: any; httpVersion: string; httpVersionMajor: number; @@ -1758,6 +2458,36 @@ declare namespace Electron { statusMessage: string; } + interface IOCounters { + + // Docs: http://electron.atom.io/docs/api/structures/io-counters + + /** + * Then number of I/O other operations. + */ + otherOperationCount?: number; + /** + * Then number of I/O other transfers. + */ + otherTransferCount?: number; + /** + * The number of I/O read operations. + */ + readOperationCount?: number; + /** + * The number of I/O read transfers. + */ + readTransferCount?: number; + /** + * The number of I/O write operations. + */ + writeOperationCount?: number; + /** + * The number of I/O write transfers. + */ + writeTransferCount?: number; + } + interface IpcMain extends EventEmitter { // Docs: http://electron.atom.io/docs/api/ipc-main @@ -1829,36 +2559,104 @@ declare namespace Electron { sendToHost(channel: string, ...args: any[]): void; } - type JumpListCategory = { + interface JumpListCategory { // Docs: http://electron.atom.io/docs/api/structures/jump-list-category + /** + * Array of objects if is or , otherwise it should be omitted. + */ items?: JumpListItem[]; + /** + * Must be set if is , otherwise it should be omitted. + */ name?: string; - type?: string; + /** + * One of the following: + */ + type?: ('tasks' | 'frequent' | 'recent' | 'custom'); } - type JumpListItem = { + interface JumpListItem { // Docs: http://electron.atom.io/docs/api/structures/jump-list-item + /** + * The command line arguments when is executed. Should only be set if is . + */ args?: string; + /** + * Description of the task (displayed in a tooltip). Should only be set if is . + */ description?: string; + /** + * The index of the icon in the resource file. If a resource file contains multiple + * icons this value can be used to specify the zero-based index of the icon that + * should be displayed for this task. If a resource file contains only one icon, + * this property should be set to zero. + */ iconIndex?: number; + /** + * The absolute path to an icon to be displayed in a Jump List, which can be an + * arbitrary resource file that contains an icon (e.g. , , ). You can usually + * specify to show the program icon. + */ iconPath?: string; + /** + * Path of the file to open, should only be set if is . + */ path?: string; + /** + * Path of the program to execute, usually you should specify which opens the + * current program. Should only be set if is . + */ program?: string; + /** + * The text to be displayed for the item in the Jump List. Should only be set if is + * . + */ title?: string; - type?: string; + /** + * One of the following: + */ + type?: ('task' | 'separator' | 'file'); } - type MemoryUsageDetails = { + interface MemoryInfo { + + // Docs: http://electron.atom.io/docs/api/structures/memory-info + + /** + * The maximum amount of memory that has ever been pinned to actual physical RAM. + */ + peakWorkingSetSize?: number; + /** + * The amount of memory not shared by other processes, such as JS heap or HTML + * content. + */ + privateBytes?: number; + /** + * The amount of memory shared between processes, typically memory consumed by the + * Electron code itself + */ + sharedBytes?: number; + /** + * Process id of the process. + */ + workingSetSize?: number; + /** + * The amount of memory currently pinned to actual physical RAM. + */ + workingSetSize?: number; + } + + interface MemoryUsageDetails { // Docs: http://electron.atom.io/docs/api/structures/memory-usage-details - count: number; - liveSize: number; - size: number; + count?: number; + liveSize?: number; + size?: number; } class Menu { @@ -1873,18 +2671,23 @@ declare namespace Electron { * items. */ static buildFromTemplate(template: MenuItemConstructorOptions[]): Menu; + /** + * Note: The returned Menu instance doesn't support dynamic addition or removal of + * menu items. Instance properties can still be dynamically modified. + */ static getApplicationMenu(): Menu; /** * Sends the action to the first responder of application. This is used for - * emulating default Cocoa menu behaviors, usually you would just use the role - * property of MenuItem. See the macOS Cocoa Event Handling Guide for more + * emulating default macOS menu behaviors. Usually you would just use the role + * property of a MenuItem. See the macOS Cocoa Event Handling Guide for more * information on macOS' native actions. */ static sendActionToFirstResponder(action: string): void; /** * Sets menu as the application menu on macOS. On Windows and Linux, the menu will - * be set as each window's top menu. Note: This API has to be called after the - * ready event of app module. + * be set as each window's top menu. Passing null will remove the menu bar on + * Windows and Linux but has no effect on macOS. Note: This API has to be called + * after the ready event of app module. */ static setApplicationMenu(menu: Menu): void; /** @@ -1918,6 +2721,20 @@ declare namespace Electron { visible: boolean; } + interface MimeTypedBuffer { + + // Docs: http://electron.atom.io/docs/api/structures/mime-typed-buffer + + /** + * The actual Buffer content + */ + data?: Buffer; + /** + * The mimeType of the Buffer that you are sending + */ + mimeType?: string; + } + class NativeImage { // Docs: http://electron.atom.io/docs/api/native-image @@ -1946,7 +2763,7 @@ declare namespace Electron { * called on empty images. */ addRepresentation(options: AddRepresentationOptions): void; - crop(rect: Rect): NativeImage; + crop(rect: Rectangle): NativeImage; getAspectRatio(): number; /** * The difference between getBitmap() and toBitmap() is, getBitmap() does not copy @@ -1991,6 +2808,14 @@ declare namespace Electron { request(options: any | string): ClientRequest; } + interface Point { + + // Docs: http://electron.atom.io/docs/api/structures/point + + x?: number; + y?: number; + } + interface PowerMonitor extends EventEmitter { // Docs: http://electron.atom.io/docs/api/power-monitor @@ -1999,18 +2824,30 @@ declare namespace Electron { * Emitted when the system changes to AC power. */ on(event: 'on-ac', listener: Function): this; + once(event: 'on-ac', listener: Function): this; + addListener(event: 'on-ac', listener: Function): this; + removeListener(event: 'on-ac', listener: Function): this; /** * Emitted when system changes to battery power. */ on(event: 'on-battery', listener: Function): this; + once(event: 'on-battery', listener: Function): this; + addListener(event: 'on-battery', listener: Function): this; + removeListener(event: 'on-battery', listener: Function): this; /** * Emitted when system is resuming. */ on(event: 'resume', listener: Function): this; + once(event: 'resume', listener: Function): this; + addListener(event: 'resume', listener: Function): this; + removeListener(event: 'resume', listener: Function): this; /** * Emitted when the system is suspending. */ on(event: 'suspend', listener: Function): this; + once(event: 'suspend', listener: Function): this; + addListener(event: 'suspend', listener: Function): this; + removeListener(event: 'suspend', listener: Function): this; } interface PowerSaveBlocker extends EventEmitter { @@ -2035,48 +2872,18 @@ declare namespace Electron { stop(id: number): void; } - interface Process extends EventEmitter { + interface ProcessMemoryInfo { - // Docs: http://electron.atom.io/docs/api/process + // Docs: http://electron.atom.io/docs/api/structures/process-memory-info /** - * Emitted when Electron has loaded its internal initialization script and is - * beginning to load the web page or the main script. It can be used by the preload - * script to add removed Node global symbols back to the global scope when node - * integration is turned off: + * Memory information of the process. */ - on(event: 'loaded', listener: Function): this; + memory?: MemoryInfo; /** - * Causes the main thread of the current process crash. + * Process id of the process. */ - crash(): void; - /** - * Returns an object giving memory usage statistics about the current process. Note - * that all statistics are reported in Kilobytes. - */ - getProcessMemoryInfo(): ProcessMemoryInfo; - /** - * Returns an object giving memory usage statistics about the entire system. Note - * that all statistics are reported in Kilobytes. - */ - getSystemMemoryInfo(): SystemMemoryInfo; - /** - * Causes the main thread of the current process hang. - */ - hang(): void; - /** - * Sets the file descriptor soft limit to maxDescriptors or the OS hard limit, - * whichever is lower for the current process. - */ - setFdLimit(maxDescriptors: number): void; - chrome: any; - defaultApp: any; - electron: any; - mas: any; - noAsar: any; - resourcesPath: any; - type: any; - windowsStore: any; + pid?: number; } interface Protocol extends EventEmitter { @@ -2087,34 +2894,34 @@ declare namespace Electron { * Intercepts scheme protocol and uses handler as the protocol's new handler which * sends a Buffer as a response. */ - interceptBufferProtocol(scheme: string, handler: (request: InterceptBufferProtocolRequest, callback: (buffer?: Buffer) => void) => void, completion?: (error: Error) => void): void; + interceptBufferProtocol(scheme: string, handler: (request?: InterceptBufferProtocolRequest, callback?: (buffer?: Buffer) => void) => void, completion?: (error?: Error) => void): void; /** * Intercepts scheme protocol and uses handler as the protocol's new handler which * sends a file as a response. */ - interceptFileProtocol(scheme: string, handler: (request: InterceptFileProtocolRequest, callback: (filePath: string) => void) => void, completion?: (error: Error) => void): void; + interceptFileProtocol(scheme: string, handler: (request?: InterceptFileProtocolRequest, callback?: (filePath?: string) => void) => void, completion?: (error?: Error) => void): void; /** * Intercepts scheme protocol and uses handler as the protocol's new handler which * sends a new HTTP request as a response. */ - interceptHttpProtocol(scheme: string, handler: (request: InterceptHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void; + interceptHttpProtocol(scheme: string, handler: (request?: InterceptHttpProtocolRequest, callback?: (redirectRequest?: RedirectRequest) => void) => void, completion?: (error?: Error) => void): void; /** * Intercepts scheme protocol and uses handler as the protocol's new handler which * sends a String as a response. */ - interceptStringProtocol(scheme: string, handler: (request: InterceptStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void; + interceptStringProtocol(scheme: string, handler: (request?: InterceptStringProtocolRequest, callback?: (data?: string) => void) => void, completion?: (error?: Error) => void): void; /** * The callback will be called with a boolean that indicates whether there is * already a handler for scheme. */ - isProtocolHandled(scheme: string, callback: (error: Error) => void): void; + isProtocolHandled(scheme: string, callback: (error?: Error) => void): void; /** * Registers a protocol of scheme that will send a Buffer as a response. The usage * is the same with registerFileProtocol, except that the callback should be called * with either a Buffer object or an object that has the data, mimeType, and * charset properties. Example: */ - registerBufferProtocol(scheme: string, handler: (request: RegisterBufferProtocolRequest, callback: (buffer?: Buffer | MimeTypedBuffer) => void) => void, completion?: (error: Error) => void): void; + registerBufferProtocol(scheme: string, handler: (request?: RegisterBufferProtocolRequest, callback?: (buffer?: Buffer | MimeTypedBuffer) => void) => void, completion?: (error?: Error) => void): void; /** * Registers a protocol of scheme that will send the file as a response. The * handler will be called with handler(request, callback) when a request is going @@ -2130,7 +2937,7 @@ declare namespace Electron { * want to call protocol.registerStandardSchemes to have your scheme treated as a * standard scheme. */ - registerFileProtocol(scheme: string, handler: (request: RegisterFileProtocolRequest, callback: (filePath?: string) => void) => void, completion?: (error: Error) => void): void; + registerFileProtocol(scheme: string, handler: (request?: RegisterFileProtocolRequest, callback?: (filePath?: string) => void) => void, completion?: (error?: Error) => void): void; /** * Registers a protocol of scheme that will send an HTTP request as a response. The * usage is the same with registerFileProtocol, except that the callback should be @@ -2139,7 +2946,7 @@ declare namespace Electron { * current session. If you want the request to have a different session you should * set session to null. For POST requests the uploadData object must be provided. */ - registerHttpProtocol(scheme: string, handler: (request: RegisterHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void; + registerHttpProtocol(scheme: string, handler: (request?: RegisterHttpProtocolRequest, callback?: (redirectRequest?: RedirectRequest) => void) => void, completion?: (error?: Error) => void): void; registerServiceWorkerSchemes(schemes: string[]): void; /** * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example @@ -2164,25 +2971,31 @@ declare namespace Electron { * with either a String or an object that has the data, mimeType, and charset * properties. */ - registerStringProtocol(scheme: string, handler: (request: RegisterStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void; + registerStringProtocol(scheme: string, handler: (request?: RegisterStringProtocolRequest, callback?: (data?: string) => void) => void, completion?: (error?: Error) => void): void; /** * Remove the interceptor installed for scheme and restore its original handler. */ - uninterceptProtocol(scheme: string, completion?: (error: Error) => void): void; + uninterceptProtocol(scheme: string, completion?: (error?: Error) => void): void; /** * Unregisters the custom protocol of scheme. */ - unregisterProtocol(scheme: string, completion?: (error: Error) => void): void; + unregisterProtocol(scheme: string, completion?: (error?: Error) => void): void; } - type Rectangle = { + interface Rectangle { // Docs: http://electron.atom.io/docs/api/structures/rectangle - height: number; - width: number; - x: number; - y: number; + height?: number; + width?: number; + /** + * The x coordinate of the origin of the rectangle + */ + x?: number; + /** + * The y coordinate of the origin of the rectangle + */ + y?: number; } interface Remote extends MainInterface { @@ -2192,8 +3005,61 @@ declare namespace Electron { getCurrentWebContents(): WebContents; getCurrentWindow(): BrowserWindow; getGlobal(name: string): any; + /** + * e.g. + */ require(module: string): any; - process: any; + /** + * The process object in the main process. This is the same as + * remote.getGlobal('process') but is cached. + */ + process?: any; + } + + interface RemoveClientCertificate { + + // Docs: http://electron.atom.io/docs/api/structures/remove-client-certificate + + /** + * Origin of the server whose associated client certificate must be removed from + * the cache. + */ + origin?: string; + /** + * . + */ + type?: string; + } + + interface RemovePassword { + + // Docs: http://electron.atom.io/docs/api/structures/remove-password + + /** + * When provided, the authentication info related to the origin will only be + * removed otherwise the entire cache will be cleared. + */ + origin?: string; + /** + * Credentials of the authentication. Must be provided if removing by . + */ + password?: string; + /** + * Realm of the authentication. Must be provided if removing by . + */ + realm?: string; + /** + * Scheme of the authentication. Can be , , , . Must be provided if removing by . + */ + scheme?: ('basic' | 'digest' | 'ntlm' | 'negotiate'); + /** + * . + */ + type?: string; + /** + * Credentials of the authentication. Must be provided if removing by . + */ + username?: string; } interface Screen extends EventEmitter { @@ -2203,31 +3069,84 @@ declare namespace Electron { /** * Emitted when newDisplay has been added. */ - on(event: 'display-added', listener: (event: Event, - newDisplay: Display) => void): this; + on(event: 'display-added', listener: (event?: Event, + newDisplay?: Display) => void): this; + once(event: 'display-added', listener: (event?: Event, + newDisplay?: Display) => void): this; + addListener(event: 'display-added', listener: (event?: Event, + newDisplay?: Display) => void): this; + removeListener(event: 'display-added', listener: (event?: Event, + newDisplay?: Display) => void): this; /** * Emitted when one or more metrics change in a display. The changedMetrics is an * array of strings that describe the changes. Possible changes are bounds, * workArea, scaleFactor and rotation. */ - on(event: 'display-metrics-changed', listener: (event: Event, - display: Display, - changedMetrics: string[]) => void): this; + on(event: 'display-metrics-changed', listener: (event?: Event, + display?: Display, + changedMetrics?: string[]) => void): this; + once(event: 'display-metrics-changed', listener: (event?: Event, + display?: Display, + changedMetrics?: string[]) => void): this; + addListener(event: 'display-metrics-changed', listener: (event?: Event, + display?: Display, + changedMetrics?: string[]) => void): this; + removeListener(event: 'display-metrics-changed', listener: (event?: Event, + display?: Display, + changedMetrics?: string[]) => void): this; /** * Emitted when oldDisplay has been removed. */ - on(event: 'display-removed', listener: (event: Event, - oldDisplay: Display) => void): this; + on(event: 'display-removed', listener: (event?: Event, + oldDisplay?: Display) => void): this; + once(event: 'display-removed', listener: (event?: Event, + oldDisplay?: Display) => void): this; + addListener(event: 'display-removed', listener: (event?: Event, + oldDisplay?: Display) => void): this; + removeListener(event: 'display-removed', listener: (event?: Event, + oldDisplay?: Display) => void): this; getAllDisplays(): Display[]; /** * The current absolute position of the mouse pointer. */ - getCursorScreenPoint(): CursorScreenPoint; + getCursorScreenPoint(): Point; getDisplayMatching(rect: Rectangle): Display; getDisplayNearestPoint(point: Point): Display; getPrimaryDisplay(): Display; } + interface ScrubberItem { + + // Docs: http://electron.atom.io/docs/api/structures/scrubber-item + + /** + * The image to appear in this item + */ + icon?: NativeImage; + /** + * The text to appear in this item + */ + label?: string; + } + + interface SegmentedControlSegment { + + // Docs: http://electron.atom.io/docs/api/structures/segmented-control-segment + + /** + * Whether this segment is selectable. Default: true + */ + enabled?: boolean; + /** + * The image to appear in this segment + */ + icon?: NativeImage; + /** + * The text to appear in this segment + */ + label?: string; + } + class Session extends EventEmitter { // Docs: http://electron.atom.io/docs/api/session @@ -2241,15 +3160,27 @@ declare namespace Electron { * before. There is no way to change the options of an existing Session object. */ static fromPartition(partition: string, options: FromPartitionOptions): Session; - static defaultSession: Session; + /** + * A Session object, the default session object of the app. + */ + static defaultSession?: Session; /** * Emitted when Electron is about to download item in webContents. Calling * event.preventDefault() will cancel the download and item will not be available * from next tick of the process. */ - on(event: 'will-download', listener: (event: Event, - item: DownloadItem, - webContents: WebContents) => void): this; + on(event: 'will-download', listener: (event?: Event, + item?: DownloadItem, + webContents?: WebContents) => void): this; + once(event: 'will-download', listener: (event?: Event, + item?: DownloadItem, + webContents?: WebContents) => void): this; + addListener(event: 'will-download', listener: (event?: Event, + item?: DownloadItem, + webContents?: WebContents) => void): this; + removeListener(event: 'will-download', listener: (event?: Event, + item?: DownloadItem, + webContents?: WebContents) => void): this; /** * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate * authentication. @@ -2292,17 +3223,17 @@ declare namespace Electron { * Writes any unwritten DOMStorage data to disk. */ flushStorageData(): void; - getBlobData(identifier: string, callback: (result: Buffer) => void): Blob; + getBlobData(identifier: string, callback: (result?: Buffer) => void): Blob; /** * Callback is invoked with the session's current cache size. */ - getCacheSize(callback: (size: number) => void): void; + getCacheSize(callback: (size?: number) => void): void; getUserAgent(): string; /** * Resolves the proxy information for url. The callback will be called with * callback(proxy) when the request is performed. */ - resolveProxy(url: URL, callback: (proxy: string) => void): void; + resolveProxy(url: string, callback: (proxy?: string) => void): void; /** * Sets the certificate verify proc for session, the proc will be called with * proc(request, callback) whenever a server certificate verification is requested. @@ -2310,7 +3241,7 @@ declare namespace Electron { * Calling setCertificateVerifyProc(null) will revert back to default certificate * verify proc. */ - setCertificateVerifyProc(proc: (request: CertificateVerifyProcRequest, callback: (verificationResult: number) => void) => void): void; + setCertificateVerifyProc(proc: (request?: CertificateVerifyProcRequest, callback?: (verificationResult?: number) => void) => void): void; /** * Sets download saving directory. By default, the download directory will be the * Downloads under the respective app folder. @@ -2321,7 +3252,7 @@ declare namespace Electron { * session. Calling callback(true) will allow the permission and callback(false) * will reject it. */ - setPermissionRequestHandler(handler: (webContents: any, permission: string, callback: (permissionGranted: boolean) => void) => void): void; + setPermissionRequestHandler(handler: (webContents?: WebContents, permission?: string, callback?: (permissionGranted?: boolean) => void) => void): void; /** * Sets the proxy settings. When pacScript and proxyRules are provided together, * the proxyRules option is ignored and pacScript configuration is applied. The @@ -2358,7 +3289,7 @@ declare namespace Electron { * Open the given external protocol URL in the desktop's default manner. (For * example, mailto: URLs in the user's default mail agent). */ - openExternal(url: string, options?: OpenExternalOptions, callback?: (error: Error) => void): boolean; + openExternal(url: string, options?: OpenExternalOptions, callback?: (error?: Error) => void): boolean; /** * Open the given file in the desktop's default manner. */ @@ -2382,35 +3313,102 @@ declare namespace Electron { writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean; } - type ShortcutDetails = { + interface ShortcutDetails { // Docs: http://electron.atom.io/docs/api/structures/shortcut-details + /** + * The Application User Model ID. Default is empty. + */ appUserModelId?: string; + /** + * The arguments to be applied to when launching from this shortcut. Default is + * empty. + */ args?: string; + /** + * The working directory. Default is empty. + */ cwd?: string; + /** + * The description of the shortcut. Default is empty. + */ description?: string; + /** + * The path to the icon, can be a DLL or EXE. and have to be set together. Default + * is empty, which uses the target's icon. + */ icon?: string; + /** + * The resource ID of icon when is a DLL or EXE. Default is 0. + */ iconIndex?: number; - target: string; + /** + * The target to launch from this shortcut. + */ + target?: string; + } + + interface Size { + + // Docs: http://electron.atom.io/docs/api/structures/size + + height?: number; + width?: number; } interface SystemPreferences extends EventEmitter { // Docs: http://electron.atom.io/docs/api/system-preferences - on(event: 'accent-color-changed', listener: (event: Event, + on(event: 'accent-color-changed', listener: (event?: Event, /** * The new RGBA color the user assigned to be their system accent color. */ - newColor: string) => void): this; - on(event: 'color-changed', listener: (event: Event) => void): this; - on(event: 'inverted-color-scheme-changed', listener: (event: Event, + newColor?: string) => void): this; + once(event: 'accent-color-changed', listener: (event?: Event, + /** + * The new RGBA color the user assigned to be their system accent color. + */ + newColor?: string) => void): this; + addListener(event: 'accent-color-changed', listener: (event?: Event, + /** + * The new RGBA color the user assigned to be their system accent color. + */ + newColor?: string) => void): this; + removeListener(event: 'accent-color-changed', listener: (event?: Event, + /** + * The new RGBA color the user assigned to be their system accent color. + */ + newColor?: string) => void): this; + on(event: 'color-changed', listener: (event?: Event) => void): this; + once(event: 'color-changed', listener: (event?: Event) => void): this; + addListener(event: 'color-changed', listener: (event?: Event) => void): this; + removeListener(event: 'color-changed', listener: (event?: Event) => void): this; + on(event: 'inverted-color-scheme-changed', listener: (event?: Event, /** * `true` if an inverted color scheme, such as a high contrast theme, is being * used, `false` otherwise. */ - invertedColorScheme: boolean) => void): this; + invertedColorScheme?: boolean) => void): this; + once(event: 'inverted-color-scheme-changed', listener: (event?: Event, + /** + * `true` if an inverted color scheme, such as a high contrast theme, is being + * used, `false` otherwise. + */ + invertedColorScheme?: boolean) => void): this; + addListener(event: 'inverted-color-scheme-changed', listener: (event?: Event, + /** + * `true` if an inverted color scheme, such as a high contrast theme, is being + * used, `false` otherwise. + */ + invertedColorScheme?: boolean) => void): this; + removeListener(event: 'inverted-color-scheme-changed', listener: (event?: Event, + /** + * `true` if an inverted color scheme, such as a high contrast theme, is being + * used, `false` otherwise. + */ + invertedColorScheme?: boolean) => void): this; getAccentColor(): string; getColor(color: '3d-dark-shadow' | '3d-face' | '3d-highlight' | '3d-light' | '3d-shadow' | 'active-border' | 'active-caption' | 'active-caption-gradient' | 'app-workspace' | 'button-text' | 'caption-text' | 'desktop' | 'disabled-text' | 'highlight' | 'highlight-text' | 'hotlight' | 'inactive-border' | 'inactive-caption' | 'inactive-caption-gradient' | 'inactive-caption-text' | 'info-background' | 'info-text' | 'menu' | 'menu-highlight' | 'menubar' | 'menu-text' | 'scrollbar' | 'window' | 'window-frame' | 'window-text'): string; /** @@ -2448,7 +3446,7 @@ declare namespace Electron { * Same as subscribeNotification, but uses NSNotificationCenter for local defaults. * This is necessary for events such as NSUserDefaultsDidChangeNotification */ - subscribeLocalNotification(event: string, callback: (event: string, userInfo: any) => void): void; + subscribeLocalNotification(event: string, callback: (event?: string, userInfo?: any) => void): void; /** * Subscribes to native notifications of macOS, callback will be called with * callback(event, userInfo) when the corresponding event happens. The userInfo is @@ -2457,7 +3455,7 @@ declare namespace Electron { * unsubscribe the event. Under the hood this API subscribes to * NSDistributedNotificationCenter, example values of event are: */ - subscribeNotification(event: string, callback: (event: string, userInfo: any) => void): void; + subscribeNotification(event: string, callback: (event?: string, userInfo?: any) => void): void; /** * Same as unsubscribeNotification, but removes the subscriber from * NSNotificationCenter. @@ -2469,28 +3467,162 @@ declare namespace Electron { unsubscribeNotification(id: number): void; } - type Task = { + interface Task { // Docs: http://electron.atom.io/docs/api/structures/task - arguments: string; - description: string; - iconIndex: number; - iconPath: string; - program: string; - title: string; + /** + * The command line arguments when is executed. + */ + arguments?: string; + /** + * Description of this task. + */ + description?: string; + /** + * The icon index in the icon file. If an icon file consists of two or more icons, + * set this value to identify the icon. If an icon file consists of one icon, this + * value is 0. + */ + iconIndex?: number; + /** + * The absolute path to an icon to be displayed in a JumpList, which can be an + * arbitrary resource file that contains an icon. You can usually specify to show + * the icon of the program. + */ + iconPath?: string; + /** + * Path of the program to execute, usually you should specify which opens the + * current program. + */ + program?: string; + /** + * The string to be displayed in a JumpList. + */ + title?: string; } - type ThumbarButton = { + interface ThumbarButton { // Docs: http://electron.atom.io/docs/api/structures/thumbar-button - click: Function; + click?: Function; + /** + * Control specific states and behaviors of the button. By default, it is . + */ flags?: string[]; - icon: NativeImage; + /** + * The icon showing in thumbnail toolbar. + */ + icon?: NativeImage; + /** + * The text of the button's tooltip. + */ tooltip?: string; } + class TouchBarButton extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/touch-bar-button + + constructor(options: TouchBarButtonConstructorOptions); + backgroundColor: string; + icon: NativeImage; + label: string; + } + + class TouchBarColorPicker extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/touch-bar-color-picker + + constructor(options: TouchBarColorPickerConstructorOptions); + availableColors: string[]; + selectedColor: string; + } + + class TouchBarGroup extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/touch-bar-group + + constructor(options: TouchBarGroupConstructorOptions); + } + + class TouchBarLabel extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/touch-bar-label + + constructor(options: TouchBarLabelConstructorOptions); + label: string; + textColor: string; + } + + class TouchBarPopover extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/touch-bar-popover + + constructor(options: TouchBarPopoverConstructorOptions); + icon: NativeImage; + label: string; + } + + class TouchBarScrubber extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/touch-bar-scrubber + + constructor(options: TouchBarScrubberConstructorOptions); + continuous: boolean; + items: ScrubberItem[]; + mode: string; + overlayStyle: string; + selectedStyle: string; + showArrowButtons: boolean; + } + + class TouchBarSegmentedControl extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/touch-bar-segmented-control + + constructor(options: TouchBarSegmentedControlConstructorOptions); + segments: SegmentedControlSegment[]; + segmentStyle: string; + selectedIndex: number; + } + + class TouchBarSlider extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/touch-bar-slider + + constructor(options: TouchBarSliderConstructorOptions); + label: string; + maxValue: number; + minValue: number; + value: number; + } + + class TouchBarSpacer extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/touch-bar-spacer + + constructor(options: TouchBarSpacerConstructorOptions); + } + + class TouchBar extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/touch-bar + + constructor(items: TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopover | TouchBarScrubber | TouchBarSegmentedControl | TouchBarSlider | TouchBarSpacer); + escapeItem: any; + static TouchBarButton: typeof TouchBarButton; + static TouchBarColorPicker: typeof TouchBarColorPicker; + static TouchBarGroup: typeof TouchBarGroup; + static TouchBarLabel: typeof TouchBarLabel; + static TouchBarPopover: typeof TouchBarPopover; + static TouchBarScrubber: typeof TouchBarScrubber; + static TouchBarSegmentedControl: typeof TouchBarSegmentedControl; + static TouchBarSlider: typeof TouchBarSlider; + static TouchBarSpacer: typeof TouchBarSpacer; + } + class Tray extends EventEmitter { // Docs: http://electron.atom.io/docs/api/tray @@ -2499,71 +3631,167 @@ declare namespace Electron { * Emitted when the tray balloon is clicked. */ on(event: 'balloon-click', listener: Function): this; + once(event: 'balloon-click', listener: Function): this; + addListener(event: 'balloon-click', listener: Function): this; + removeListener(event: 'balloon-click', listener: Function): this; /** * Emitted when the tray balloon is closed because of timeout or user manually * closes it. */ on(event: 'balloon-closed', listener: Function): this; + once(event: 'balloon-closed', listener: Function): this; + addListener(event: 'balloon-closed', listener: Function): this; + removeListener(event: 'balloon-closed', listener: Function): this; /** * Emitted when the tray balloon shows. */ on(event: 'balloon-show', listener: Function): this; + once(event: 'balloon-show', listener: Function): this; + addListener(event: 'balloon-show', listener: Function): this; + removeListener(event: 'balloon-show', listener: Function): this; /** * Emitted when the tray icon is clicked. */ - on(event: 'click', listener: (event: Event, + on(event: 'click', listener: (event?: Event, /** * The bounds of tray icon */ - bounds: Rectangle) => void): this; + bounds?: Rectangle) => void): this; + once(event: 'click', listener: (event?: Event, + /** + * The bounds of tray icon + */ + bounds?: Rectangle) => void): this; + addListener(event: 'click', listener: (event?: Event, + /** + * The bounds of tray icon + */ + bounds?: Rectangle) => void): this; + removeListener(event: 'click', listener: (event?: Event, + /** + * The bounds of tray icon + */ + bounds?: Rectangle) => void): this; /** * Emitted when the tray icon is double clicked. */ - on(event: 'double-click', listener: (event: Event, + on(event: 'double-click', listener: (event?: Event, /** * The bounds of tray icon */ - bounds: Rectangle) => void): this; + bounds?: Rectangle) => void): this; + once(event: 'double-click', listener: (event?: Event, + /** + * The bounds of tray icon + */ + bounds?: Rectangle) => void): this; + addListener(event: 'double-click', listener: (event?: Event, + /** + * The bounds of tray icon + */ + bounds?: Rectangle) => void): this; + removeListener(event: 'double-click', listener: (event?: Event, + /** + * The bounds of tray icon + */ + bounds?: Rectangle) => void): this; /** * Emitted when a drag operation ends on the tray or ends at another location. */ on(event: 'drag-end', listener: Function): this; + once(event: 'drag-end', listener: Function): this; + addListener(event: 'drag-end', listener: Function): this; + removeListener(event: 'drag-end', listener: Function): this; /** * Emitted when a drag operation enters the tray icon. */ on(event: 'drag-enter', listener: Function): this; + once(event: 'drag-enter', listener: Function): this; + addListener(event: 'drag-enter', listener: Function): this; + removeListener(event: 'drag-enter', listener: Function): this; /** * Emitted when a drag operation exits the tray icon. */ on(event: 'drag-leave', listener: Function): this; + once(event: 'drag-leave', listener: Function): this; + addListener(event: 'drag-leave', listener: Function): this; + removeListener(event: 'drag-leave', listener: Function): this; /** * Emitted when any dragged items are dropped on the tray icon. */ on(event: 'drop', listener: Function): this; + once(event: 'drop', listener: Function): this; + addListener(event: 'drop', listener: Function): this; + removeListener(event: 'drop', listener: Function): this; /** * Emitted when dragged files are dropped in the tray icon. */ - on(event: 'drop-files', listener: (event: Event, + on(event: 'drop-files', listener: (event?: Event, /** * The paths of the dropped files. */ - files: string[]) => void): this; + files?: string[]) => void): this; + once(event: 'drop-files', listener: (event?: Event, + /** + * The paths of the dropped files. + */ + files?: string[]) => void): this; + addListener(event: 'drop-files', listener: (event?: Event, + /** + * The paths of the dropped files. + */ + files?: string[]) => void): this; + removeListener(event: 'drop-files', listener: (event?: Event, + /** + * The paths of the dropped files. + */ + files?: string[]) => void): this; /** * Emitted when dragged text is dropped in the tray icon. */ - on(event: 'drop-text', listener: (event: Event, + on(event: 'drop-text', listener: (event?: Event, /** * the dropped text string */ - text: string) => void): this; + text?: string) => void): this; + once(event: 'drop-text', listener: (event?: Event, + /** + * the dropped text string + */ + text?: string) => void): this; + addListener(event: 'drop-text', listener: (event?: Event, + /** + * the dropped text string + */ + text?: string) => void): this; + removeListener(event: 'drop-text', listener: (event?: Event, + /** + * the dropped text string + */ + text?: string) => void): this; /** * Emitted when the tray icon is right clicked. */ - on(event: 'right-click', listener: (event: Event, + on(event: 'right-click', listener: (event?: Event, /** * The bounds of tray icon */ - bounds: Rectangle) => void): this; + bounds?: Rectangle) => void): this; + once(event: 'right-click', listener: (event?: Event, + /** + * The bounds of tray icon + */ + bounds?: Rectangle) => void): this; + addListener(event: 'right-click', listener: (event?: Event, + /** + * The bounds of tray icon + */ + bounds?: Rectangle) => void): this; + removeListener(event: 'right-click', listener: (event?: Event, + /** + * The bounds of tray icon + */ + bounds?: Rectangle) => void): this; constructor(image: NativeImage | string); /** * Destroys the tray icon immediately. @@ -2583,7 +3811,7 @@ declare namespace Electron { * shown instead of the tray icon's context menu. The position is only available on * Windows, and it is (0, 0) by default. */ - popUpContextMenu(menu?: Menu, position?: Position): void; + popUpContextMenu(menu?: Menu, position?: Point): void; /** * Sets the context menu for this icon. */ @@ -2612,13 +3840,102 @@ declare namespace Electron { setToolTip(toolTip: string): void; } - type UploadData = { + interface UploadBlob { + + // Docs: http://electron.atom.io/docs/api/structures/upload-blob + + /** + * UUID of blob data to upload. + */ + blobUUID?: string; + /** + * . + */ + type?: string; + } + + interface UploadData { // Docs: http://electron.atom.io/docs/api/structures/upload-data - blobUUID: string; - bytes: Buffer; - file: string; + /** + * UUID of blob data. Use method to retrieve the data. + */ + blobUUID?: string; + /** + * Content being sent. + */ + bytes?: Buffer; + /** + * Path of file being uploaded. + */ + file?: string; + } + + interface UploadFile { + + // Docs: http://electron.atom.io/docs/api/structures/upload-file + + /** + * Path of file to be uploaded. + */ + filePath?: string; + /** + * Number of bytes to read from . Defaults to . + */ + length?: number; + /** + * Last Modification time in number of seconds sine the UNIX epoch. + */ + modificationTime?: number; + /** + * Defaults to . + */ + offset?: number; + /** + * . + */ + type?: string; + } + + interface UploadFileSystem { + + // Docs: http://electron.atom.io/docs/api/structures/upload-file-system + + /** + * FileSystem url to read data for upload. + */ + filsSystemURL?: string; + /** + * Number of bytes to read from . Defaults to . + */ + length?: number; + /** + * Last Modification time in number of seconds sine the UNIX epoch. + */ + modificationTime?: number; + /** + * Defaults to . + */ + offset?: number; + /** + * . + */ + type?: string; + } + + interface UploadRawData { + + // Docs: http://electron.atom.io/docs/api/structures/upload-raw-data + + /** + * Data to be uploaded. + */ + bytes?: Buffer; + /** + * . + */ + type?: string; } class WebContents extends EventEmitter { @@ -2633,33 +3950,84 @@ declare namespace Electron { * event.preventDefault will prevent the page keydown/keyup events from being * dispatched. */ - on(event: 'before-input-event', listener: (event: Event, + on(event: 'before-input-event', listener: (event?: Event, /** * Input properties */ - input: Input) => void): this; + input?: Input) => void): this; + once(event: 'before-input-event', listener: (event?: Event, + /** + * Input properties + */ + input?: Input) => void): this; + addListener(event: 'before-input-event', listener: (event?: Event, + /** + * Input properties + */ + input?: Input) => void): this; + removeListener(event: 'before-input-event', listener: (event?: Event, + /** + * Input properties + */ + input?: Input) => void): this; /** * Emitted when failed to verify the certificate for url. The usage is the same * with the certificate-error event of app. */ - on(event: 'certificate-error', listener: (event: Event, - url: string, + on(event: 'certificate-error', listener: (event?: Event, + url?: string, /** * The error code */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; + error?: string, + certificate?: Certificate, + callback?: (isTrusted?: boolean) => void) => void): this; + once(event: 'certificate-error', listener: (event?: Event, + url?: string, + /** + * The error code + */ + error?: string, + certificate?: Certificate, + callback?: (isTrusted?: boolean) => void) => void): this; + addListener(event: 'certificate-error', listener: (event?: Event, + url?: string, + /** + * The error code + */ + error?: string, + certificate?: Certificate, + callback?: (isTrusted?: boolean) => void) => void): this; + removeListener(event: 'certificate-error', listener: (event?: Event, + url?: string, + /** + * The error code + */ + error?: string, + certificate?: Certificate, + callback?: (isTrusted?: boolean) => void) => void): this; /** * Emitted when there is a new context menu that needs to be handled. */ - on(event: 'context-menu', listener: (event: Event, - params: ContextMenuParams) => void): this; + on(event: 'context-menu', listener: (event?: Event, + params?: ContextMenuParams) => void): this; + once(event: 'context-menu', listener: (event?: Event, + params?: ContextMenuParams) => void): this; + addListener(event: 'context-menu', listener: (event?: Event, + params?: ContextMenuParams) => void): this; + removeListener(event: 'context-menu', listener: (event?: Event, + params?: ContextMenuParams) => void): this; /** * Emitted when the renderer process crashes or is killed. */ - on(event: 'crashed', listener: (event: Event, - killed: boolean) => void): this; + on(event: 'crashed', listener: (event?: Event, + killed?: boolean) => void): this; + once(event: 'crashed', listener: (event?: Event, + killed?: boolean) => void): this; + addListener(event: 'crashed', listener: (event?: Event, + killed?: boolean) => void): this; + removeListener(event: 'crashed', listener: (event?: Event, + killed?: boolean) => void): this; /** * Emitted when the cursor's type changes. The type parameter can be default, * crosshair, pointer, text, wait, help, e-resize, n-resize, ne-resize, nw-resize, @@ -2672,8 +4040,8 @@ declare namespace Electron { * and scale, size and hotspot will hold additional information about the custom * cursor. */ - on(event: 'cursor-changed', listener: (event: Event, - type: string, + on(event: 'cursor-changed', listener: (event?: Event, + type?: string, image?: NativeImage, /** * scaling factor for the custom cursor @@ -2686,125 +4054,311 @@ declare namespace Electron { /** * coordinates of the custom cursor's hotspot */ - hotspot?: Hotspot) => void): this; + hotspot?: Point) => void): this; + once(event: 'cursor-changed', listener: (event?: Event, + type?: string, + image?: NativeImage, + /** + * scaling factor for the custom cursor + */ + scale?: number, + /** + * the size of the `image` + */ + size?: Size, + /** + * coordinates of the custom cursor's hotspot + */ + hotspot?: Point) => void): this; + addListener(event: 'cursor-changed', listener: (event?: Event, + type?: string, + image?: NativeImage, + /** + * scaling factor for the custom cursor + */ + scale?: number, + /** + * the size of the `image` + */ + size?: Size, + /** + * coordinates of the custom cursor's hotspot + */ + hotspot?: Point) => void): this; + removeListener(event: 'cursor-changed', listener: (event?: Event, + type?: string, + image?: NativeImage, + /** + * scaling factor for the custom cursor + */ + scale?: number, + /** + * the size of the `image` + */ + size?: Size, + /** + * coordinates of the custom cursor's hotspot + */ + hotspot?: Point) => void): this; /** * Emitted when webContents is destroyed. */ on(event: 'destroyed', listener: Function): this; + once(event: 'destroyed', listener: Function): this; + addListener(event: 'destroyed', listener: Function): this; + removeListener(event: 'destroyed', listener: Function): this; /** * Emitted when DevTools is closed. */ on(event: 'devtools-closed', listener: Function): this; + once(event: 'devtools-closed', listener: Function): this; + addListener(event: 'devtools-closed', listener: Function): this; + removeListener(event: 'devtools-closed', listener: Function): this; /** * Emitted when DevTools is focused / opened. */ on(event: 'devtools-focused', listener: Function): this; + once(event: 'devtools-focused', listener: Function): this; + addListener(event: 'devtools-focused', listener: Function): this; + removeListener(event: 'devtools-focused', listener: Function): this; /** * Emitted when DevTools is opened. */ on(event: 'devtools-opened', listener: Function): this; + once(event: 'devtools-opened', listener: Function): this; + addListener(event: 'devtools-opened', listener: Function): this; + removeListener(event: 'devtools-opened', listener: Function): this; /** * Emitted when the devtools window instructs the webContents to reload */ on(event: 'devtools-reload-page', listener: Function): this; + once(event: 'devtools-reload-page', listener: Function): this; + addListener(event: 'devtools-reload-page', listener: Function): this; + removeListener(event: 'devtools-reload-page', listener: Function): this; /** * Emitted when a page's theme color changes. This is usually due to encountering a * meta tag: */ on(event: 'did-change-theme-color', listener: Function): this; + once(event: 'did-change-theme-color', listener: Function): this; + addListener(event: 'did-change-theme-color', listener: Function): this; + removeListener(event: 'did-change-theme-color', listener: Function): this; /** * This event is like did-finish-load but emitted when the load failed or was * cancelled, e.g. window.stop() is invoked. The full list of error codes and their * meaning is available here. */ - on(event: 'did-fail-load', listener: (event: Event, - errorCode: number, - errorDescription: string, - validatedURL: string, - isMainFrame: boolean) => void): this; + on(event: 'did-fail-load', listener: (event?: Event, + errorCode?: number, + errorDescription?: string, + validatedURL?: string, + isMainFrame?: boolean) => void): this; + once(event: 'did-fail-load', listener: (event?: Event, + errorCode?: number, + errorDescription?: string, + validatedURL?: string, + isMainFrame?: boolean) => void): this; + addListener(event: 'did-fail-load', listener: (event?: Event, + errorCode?: number, + errorDescription?: string, + validatedURL?: string, + isMainFrame?: boolean) => void): this; + removeListener(event: 'did-fail-load', listener: (event?: Event, + errorCode?: number, + errorDescription?: string, + validatedURL?: string, + isMainFrame?: boolean) => void): this; /** * Emitted when the navigation is done, i.e. the spinner of the tab has stopped * spinning, and the onload event was dispatched. */ on(event: 'did-finish-load', listener: Function): this; + once(event: 'did-finish-load', listener: Function): this; + addListener(event: 'did-finish-load', listener: Function): this; + removeListener(event: 'did-finish-load', listener: Function): this; /** * Emitted when a frame has done navigation. */ - on(event: 'did-frame-finish-load', listener: (event: Event, - isMainFrame: boolean) => void): this; + on(event: 'did-frame-finish-load', listener: (event?: Event, + isMainFrame?: boolean) => void): this; + once(event: 'did-frame-finish-load', listener: (event?: Event, + isMainFrame?: boolean) => void): this; + addListener(event: 'did-frame-finish-load', listener: (event?: Event, + isMainFrame?: boolean) => void): this; + removeListener(event: 'did-frame-finish-load', listener: (event?: Event, + isMainFrame?: boolean) => void): this; /** * Emitted when a redirect is received while requesting a resource. */ - on(event: 'did-get-redirect-request', listener: (event: Event, - oldURL: string, - newURL: string, - isMainFrame: boolean, - httpResponseCode: number, - requestMethod: string, - referrer: string, - headers: any) => void): this; + on(event: 'did-get-redirect-request', listener: (event?: Event, + oldURL?: string, + newURL?: string, + isMainFrame?: boolean, + httpResponseCode?: number, + requestMethod?: string, + referrer?: string, + headers?: any) => void): this; + once(event: 'did-get-redirect-request', listener: (event?: Event, + oldURL?: string, + newURL?: string, + isMainFrame?: boolean, + httpResponseCode?: number, + requestMethod?: string, + referrer?: string, + headers?: any) => void): this; + addListener(event: 'did-get-redirect-request', listener: (event?: Event, + oldURL?: string, + newURL?: string, + isMainFrame?: boolean, + httpResponseCode?: number, + requestMethod?: string, + referrer?: string, + headers?: any) => void): this; + removeListener(event: 'did-get-redirect-request', listener: (event?: Event, + oldURL?: string, + newURL?: string, + isMainFrame?: boolean, + httpResponseCode?: number, + requestMethod?: string, + referrer?: string, + headers?: any) => void): this; /** * Emitted when details regarding a requested resource are available. status * indicates the socket connection to download the resource. */ - on(event: 'did-get-response-details', listener: (event: Event, - status: boolean, - newURL: string, - originalURL: string, - httpResponseCode: number, - requestMethod: string, - referrer: string, - headers: any, - resourceType: string) => void): this; + on(event: 'did-get-response-details', listener: (event?: Event, + status?: boolean, + newURL?: string, + originalURL?: string, + httpResponseCode?: number, + requestMethod?: string, + referrer?: string, + headers?: any, + resourceType?: string) => void): this; + once(event: 'did-get-response-details', listener: (event?: Event, + status?: boolean, + newURL?: string, + originalURL?: string, + httpResponseCode?: number, + requestMethod?: string, + referrer?: string, + headers?: any, + resourceType?: string) => void): this; + addListener(event: 'did-get-response-details', listener: (event?: Event, + status?: boolean, + newURL?: string, + originalURL?: string, + httpResponseCode?: number, + requestMethod?: string, + referrer?: string, + headers?: any, + resourceType?: string) => void): this; + removeListener(event: 'did-get-response-details', listener: (event?: Event, + status?: boolean, + newURL?: string, + originalURL?: string, + httpResponseCode?: number, + requestMethod?: string, + referrer?: string, + headers?: any, + resourceType?: string) => void): this; /** * Emitted when a navigation is done. This event is not emitted for in-page * navigations, such as clicking anchor links or updating the window.location.hash. * Use did-navigate-in-page event for this purpose. */ - on(event: 'did-navigate', listener: (event: Event, - url: string) => void): this; + on(event: 'did-navigate', listener: (event?: Event, + url?: string) => void): this; + once(event: 'did-navigate', listener: (event?: Event, + url?: string) => void): this; + addListener(event: 'did-navigate', listener: (event?: Event, + url?: string) => void): this; + removeListener(event: 'did-navigate', listener: (event?: Event, + url?: string) => void): this; /** * Emitted when an in-page navigation happened. When in-page navigation happens, * the page URL changes but does not cause navigation outside of the page. Examples * of this occurring are when anchor links are clicked or when the DOM hashchange * event is triggered. */ - on(event: 'did-navigate-in-page', listener: (event: Event, - url: string, - isMainFrame: boolean) => void): this; + on(event: 'did-navigate-in-page', listener: (event?: Event, + url?: string, + isMainFrame?: boolean) => void): this; + once(event: 'did-navigate-in-page', listener: (event?: Event, + url?: string, + isMainFrame?: boolean) => void): this; + addListener(event: 'did-navigate-in-page', listener: (event?: Event, + url?: string, + isMainFrame?: boolean) => void): this; + removeListener(event: 'did-navigate-in-page', listener: (event?: Event, + url?: string, + isMainFrame?: boolean) => void): this; /** * Corresponds to the points in time when the spinner of the tab started spinning. */ on(event: 'did-start-loading', listener: Function): this; + once(event: 'did-start-loading', listener: Function): this; + addListener(event: 'did-start-loading', listener: Function): this; + removeListener(event: 'did-start-loading', listener: Function): this; /** * Corresponds to the points in time when the spinner of the tab stopped spinning. */ on(event: 'did-stop-loading', listener: Function): this; + once(event: 'did-stop-loading', listener: Function): this; + addListener(event: 'did-stop-loading', listener: Function): this; + removeListener(event: 'did-stop-loading', listener: Function): this; /** * Emitted when the document in the given frame is loaded. */ - on(event: 'dom-ready', listener: (event: Event) => void): this; + on(event: 'dom-ready', listener: (event?: Event) => void): this; + once(event: 'dom-ready', listener: (event?: Event) => void): this; + addListener(event: 'dom-ready', listener: (event?: Event) => void): this; + removeListener(event: 'dom-ready', listener: (event?: Event) => void): this; /** * Emitted when a result is available for [webContents.findInPage] request. */ - on(event: 'found-in-page', listener: (event: Event, - result: Result) => void): this; + on(event: 'found-in-page', listener: (event?: Event, + result?: Result) => void): this; + once(event: 'found-in-page', listener: (event?: Event, + result?: Result) => void): this; + addListener(event: 'found-in-page', listener: (event?: Event, + result?: Result) => void): this; + removeListener(event: 'found-in-page', listener: (event?: Event, + result?: Result) => void): this; /** * Emitted when webContents wants to do basic auth. The usage is the same with the * login event of app. */ - on(event: 'login', listener: (event: Event, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; + on(event: 'login', listener: (event?: Event, + request?: Request, + authInfo?: AuthInfo, + callback?: (username?: string, password?: string) => void) => void): this; + once(event: 'login', listener: (event?: Event, + request?: Request, + authInfo?: AuthInfo, + callback?: (username?: string, password?: string) => void) => void): this; + addListener(event: 'login', listener: (event?: Event, + request?: Request, + authInfo?: AuthInfo, + callback?: (username?: string, password?: string) => void) => void): this; + removeListener(event: 'login', listener: (event?: Event, + request?: Request, + authInfo?: AuthInfo, + callback?: (username?: string, password?: string) => void) => void): this; /** * Emitted when media is paused or done playing. */ on(event: 'media-paused', listener: Function): this; + once(event: 'media-paused', listener: Function): this; + addListener(event: 'media-paused', listener: Function): this; + removeListener(event: 'media-paused', listener: Function): this; /** * Emitted when media starts playing. */ on(event: 'media-started-playing', listener: Function): this; + once(event: 'media-started-playing', listener: Function): this; + addListener(event: 'media-started-playing', listener: Function): this; + removeListener(event: 'media-started-playing', listener: Function): this; /** * Emitted when the page requests to open a new window for a url. It could be * requested by window.open or an external link like . By @@ -2815,47 +4369,140 @@ declare namespace Electron { * BrowserWindow instance, failing to do so may result in unexpected behavior. For * example: */ - on(event: 'new-window', listener: (event: Event, - url: string, - frameName: string, + on(event: 'new-window', listener: (event?: Event, + url?: string, + frameName?: string, /** * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, * `save-to-disk` and `other`. */ - disposition: string, + disposition?: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), /** * The options which will be used for creating the new `BrowserWindow`. */ - options: any, + options?: any, /** * The non-standard features (features not handled by Chromium or Electron) given * to `window.open()`. */ - additionalFeatures: string[]) => void): this; + additionalFeatures?: string[]) => void): this; + once(event: 'new-window', listener: (event?: Event, + url?: string, + frameName?: string, + /** + * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, + * `save-to-disk` and `other`. + */ + disposition?: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), + /** + * The options which will be used for creating the new `BrowserWindow`. + */ + options?: any, + /** + * The non-standard features (features not handled by Chromium or Electron) given + * to `window.open()`. + */ + additionalFeatures?: string[]) => void): this; + addListener(event: 'new-window', listener: (event?: Event, + url?: string, + frameName?: string, + /** + * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, + * `save-to-disk` and `other`. + */ + disposition?: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), + /** + * The options which will be used for creating the new `BrowserWindow`. + */ + options?: any, + /** + * The non-standard features (features not handled by Chromium or Electron) given + * to `window.open()`. + */ + additionalFeatures?: string[]) => void): this; + removeListener(event: 'new-window', listener: (event?: Event, + url?: string, + frameName?: string, + /** + * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, + * `save-to-disk` and `other`. + */ + disposition?: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), + /** + * The options which will be used for creating the new `BrowserWindow`. + */ + options?: any, + /** + * The non-standard features (features not handled by Chromium or Electron) given + * to `window.open()`. + */ + additionalFeatures?: string[]) => void): this; /** * Emitted when page receives favicon urls. */ - on(event: 'page-favicon-updated', listener: (event: Event, + on(event: 'page-favicon-updated', listener: (event?: Event, /** * Array of URLs */ - favicons: string[]) => void): this; + favicons?: string[]) => void): this; + once(event: 'page-favicon-updated', listener: (event?: Event, + /** + * Array of URLs + */ + favicons?: string[]) => void): this; + addListener(event: 'page-favicon-updated', listener: (event?: Event, + /** + * Array of URLs + */ + favicons?: string[]) => void): this; + removeListener(event: 'page-favicon-updated', listener: (event?: Event, + /** + * Array of URLs + */ + favicons?: string[]) => void): this; /** * Emitted when a new frame is generated. Only the dirty area is passed in the * buffer. */ - on(event: 'paint', listener: (event: Event, - dirtyRect: Rectangle, + on(event: 'paint', listener: (event?: Event, + dirtyRect?: Rectangle, /** * The image data of the whole frame. */ - image: NativeImage) => void): this; + image?: NativeImage) => void): this; + once(event: 'paint', listener: (event?: Event, + dirtyRect?: Rectangle, + /** + * The image data of the whole frame. + */ + image?: NativeImage) => void): this; + addListener(event: 'paint', listener: (event?: Event, + dirtyRect?: Rectangle, + /** + * The image data of the whole frame. + */ + image?: NativeImage) => void): this; + removeListener(event: 'paint', listener: (event?: Event, + dirtyRect?: Rectangle, + /** + * The image data of the whole frame. + */ + image?: NativeImage) => void): this; /** * Emitted when a plugin process has crashed. */ - on(event: 'plugin-crashed', listener: (event: Event, - name: string, - version: string) => void): this; + on(event: 'plugin-crashed', listener: (event?: Event, + name?: string, + version?: string) => void): this; + once(event: 'plugin-crashed', listener: (event?: Event, + name?: string, + version?: string) => void): this; + addListener(event: 'plugin-crashed', listener: (event?: Event, + name?: string, + version?: string) => void): this; + removeListener(event: 'plugin-crashed', listener: (event?: Event, + name?: string, + version?: string) => void): this; /** * Emitted when bluetooth device needs to be selected on call to * navigator.bluetooth.requestDevice. To use navigator.bluetooth api webBluetooth @@ -2863,22 +4510,49 @@ declare namespace Electron { * device will be selected. callback should be called with deviceId to be selected, * passing empty string to callback will cancel the request. */ - on(event: 'select-bluetooth-device', listener: (event: Event, - devices: BluetoothDevice[], - callback: (deviceId: string) => void) => void): this; + on(event: 'select-bluetooth-device', listener: (event?: Event, + devices?: BluetoothDevice[], + callback?: (deviceId?: string) => void) => void): this; + once(event: 'select-bluetooth-device', listener: (event?: Event, + devices?: BluetoothDevice[], + callback?: (deviceId?: string) => void) => void): this; + addListener(event: 'select-bluetooth-device', listener: (event?: Event, + devices?: BluetoothDevice[], + callback?: (deviceId?: string) => void) => void): this; + removeListener(event: 'select-bluetooth-device', listener: (event?: Event, + devices?: BluetoothDevice[], + callback?: (deviceId?: string) => void) => void): this; /** * Emitted when a client certificate is requested. The usage is the same with the * select-client-certificate event of app. */ - on(event: 'select-client-certificate', listener: (event: Event, - url: URL, - certificateList: Certificate[], - callback: (certificate: Certificate) => void) => void): this; + on(event: 'select-client-certificate', listener: (event?: Event, + url?: string, + certificateList?: Certificate[], + callback?: (certificate?: Certificate) => void) => void): this; + once(event: 'select-client-certificate', listener: (event?: Event, + url?: string, + certificateList?: Certificate[], + callback?: (certificate?: Certificate) => void) => void): this; + addListener(event: 'select-client-certificate', listener: (event?: Event, + url?: string, + certificateList?: Certificate[], + callback?: (certificate?: Certificate) => void) => void): this; + removeListener(event: 'select-client-certificate', listener: (event?: Event, + url?: string, + certificateList?: Certificate[], + callback?: (certificate?: Certificate) => void) => void): this; /** * Emitted when mouse moves over a link or the keyboard moves the focus to a link. */ - on(event: 'update-target-url', listener: (event: Event, - url: string) => void): this; + on(event: 'update-target-url', listener: (event?: Event, + url?: string) => void): this; + once(event: 'update-target-url', listener: (event?: Event, + url?: string) => void): this; + addListener(event: 'update-target-url', listener: (event?: Event, + url?: string) => void): this; + removeListener(event: 'update-target-url', listener: (event?: Event, + url?: string) => void): this; /** * Emitted when a 's web contents is being attached to this web contents. * Calling event.preventDefault() will destroy the guest page. This event can be @@ -2886,17 +4560,50 @@ declare namespace Electron { * loaded, and provides the ability to set settings that can't be set via * attributes. */ - on(event: 'will-attach-webview', listener: (event: Event, + on(event: 'will-attach-webview', listener: (event?: Event, /** * The web preferences that will be used by the guest page. This object can be * modified to adjust the preferences for the guest page. */ - webPreferences: any, + webPreferences?: any, /** * The other `` parameters such as the `src` URL. This object can be * modified to adjust the parameters of the guest page. */ - params: any) => void): this; + params?: any) => void): this; + once(event: 'will-attach-webview', listener: (event?: Event, + /** + * The web preferences that will be used by the guest page. This object can be + * modified to adjust the preferences for the guest page. + */ + webPreferences?: any, + /** + * The other `` parameters such as the `src` URL. This object can be + * modified to adjust the parameters of the guest page. + */ + params?: any) => void): this; + addListener(event: 'will-attach-webview', listener: (event?: Event, + /** + * The web preferences that will be used by the guest page. This object can be + * modified to adjust the preferences for the guest page. + */ + webPreferences?: any, + /** + * The other `` parameters such as the `src` URL. This object can be + * modified to adjust the parameters of the guest page. + */ + params?: any) => void): this; + removeListener(event: 'will-attach-webview', listener: (event?: Event, + /** + * The web preferences that will be used by the guest page. This object can be + * modified to adjust the preferences for the guest page. + */ + webPreferences?: any, + /** + * The other `` parameters such as the `src` URL. This object can be + * modified to adjust the parameters of the guest page. + */ + params?: any) => void): this; /** * Emitted when a user or the page wants to start navigation. It can happen when * the window.location object is changed or a user clicks a link in the page. This @@ -2906,8 +4613,14 @@ declare namespace Electron { * window.location.hash. Use did-navigate-in-page event for this purpose. Calling * event.preventDefault() will prevent the navigation. */ - on(event: 'will-navigate', listener: (event: Event, - url: string) => void): this; + on(event: 'will-navigate', listener: (event?: Event, + url?: string) => void): this; + once(event: 'will-navigate', listener: (event?: Event, + url?: string) => void): this; + addListener(event: 'will-navigate', listener: (event?: Event, + url?: string) => void): this; + removeListener(event: 'will-navigate', listener: (event?: Event, + url?: string) => void): this; /** * Adds the specified path to DevTools workspace. Must be used after DevTools * creation: @@ -2925,7 +4638,7 @@ declare namespace Electron { * set to true, frameBuffer will only contain the repainted area. onlyDirty * defaults to false. */ - beginFrameSubscription(callback: (frameBuffer: Buffer, dirtyRect: Rectangle) => void): void; + beginFrameSubscription(callback: (frameBuffer?: Buffer, dirtyRect?: Rectangle) => void): void; /** * Begin subscribing for presentation events and captured frames, the callback will * be called with callback(frameBuffer, dirtyRect) when there is a presentation @@ -2938,7 +4651,7 @@ declare namespace Electron { * set to true, frameBuffer will only contain the repainted area. onlyDirty * defaults to false. */ - beginFrameSubscription(onlyDirty: boolean, callback: (frameBuffer: Buffer, dirtyRect: Rectangle) => void): void; + beginFrameSubscription(onlyDirty: boolean, callback: (frameBuffer?: Buffer, dirtyRect?: Rectangle) => void): void; canGoBack(): boolean; canGoForward(): boolean; canGoToOffset(offset: number): boolean; @@ -2947,13 +4660,13 @@ declare namespace Electron { * called with callback(image). The image is an instance of NativeImage that stores * data of the snapshot. Omitting rect will capture the whole visible page. */ - capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; + capturePage(rect: Rectangle, callback: (image?: NativeImage) => void): void; /** * Captures a snapshot of the page within rect. Upon completion callback will be * called with callback(image). The image is an instance of NativeImage that stores * data of the snapshot. Omitting rect will capture the whole visible page. */ - capturePage(callback: (image: NativeImage) => void): void; + capturePage(callback: (image?: NativeImage) => void): void; /** * Clears the navigation history. */ @@ -3003,7 +4716,7 @@ declare namespace Electron { * We recommend that you use the returned Promise to handle code that results in a * Promise. */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise; + executeJavaScript(code: string, userGesture?: boolean, callback?: (result?: any) => void): Promise; /** * Starts a request to find all matches for the text in the web page and returns an * Integer representing the request id used for the request. The result of the @@ -3014,17 +4727,17 @@ declare namespace Electron { getTitle(): string; getURL(): string; getUserAgent(): string; - getWebRTCIPHandlingPolicy(): void; + getWebRTCIPHandlingPolicy(): string; /** * Sends a request to get current zoom factor, the callback will be called with * callback(zoomFactor). */ - getZoomFactor(callback: (zoomFactor: number) => void): void; + getZoomFactor(callback: (zoomFactor?: number) => void): void; /** * Sends a request to get current zoom level, the callback will be called with * callback(zoomLevel). */ - getZoomLevel(callback: (zoomLevel: number) => void): void; + getZoomLevel(callback: (zoomLevel?: number) => void): void; /** * Makes the browser go back a web page. */ @@ -3045,7 +4758,7 @@ declare namespace Electron { * Checks if any ServiceWorker is registered and returns a boolean as response to * callback. */ - hasServiceWorker(callback: (hasWorker: boolean) => void): void; + hasServiceWorker(callback: (hasWorker?: boolean) => void): void; /** * Injects CSS into the current web page. */ @@ -3113,7 +4826,7 @@ declare namespace Electron { * options will be regarded as: Use page-break-before: always; CSS style to force * to print to a new page. An example of webContents.printToPDF: */ - printToPDF(options: PrintToPDFOptions, callback: (error: Error, data: Buffer) => void): void; + printToPDF(options: PrintToPDFOptions, callback: (error?: Error, data?: Buffer) => void): void; /** * Executes the editing command redo in web page. */ @@ -3138,7 +4851,7 @@ declare namespace Electron { * Executes the editing command replaceMisspelling in web page. */ replaceMisspelling(text: string): void; - savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML', callback: (error: Error) => void): boolean; + savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML', callback: (error?: Error) => void): boolean; /** * Executes the editing command selectAll in web page. */ @@ -3243,7 +4956,7 @@ declare namespace Electron { * callback when the JS promise is fulfilled or false when the JS promise is * rejected. */ - unregisterServiceWorker(callback: (success: boolean) => void): void; + unregisterServiceWorker(callback: (success?: boolean) => void): void; /** * Executes the editing command unselect in web page. */ @@ -3273,7 +4986,7 @@ declare namespace Electron { * requestFullScreen can only be invoked by a gesture from the user. Setting * userGesture to true will remove this limitation. */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): void; + executeJavaScript(code: string, userGesture?: boolean, callback?: (result?: any) => void): Promise; /** * Returns an object describing usage information of Blink's internal memory * caches. This will generate: @@ -3339,6 +5052,530 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/web-request + /** + * The listener will be called with listener(details) when a server initiated + * redirect is about to occur. + */ + onBeforeRedirect(filter: OnBeforeRedirectFilter, listener: (details?: OnBeforeRedirectDetails) => void): void; + /** + * The listener will be called with listener(details, callback) when a request is + * about to occur. The uploadData is an array of UploadData objects. The callback + * has to be called with an response object. + */ + onBeforeRequest(filter: OnBeforeRequestFilter, listener: (details?: OnBeforeRequestDetails, callback?: (response?: Response) => void) => void): void; + /** + * The listener will be called with listener(details, callback) before sending an + * HTTP request, once the request headers are available. This may occur after a TCP + * connection is made to the server, but before any http data is sent. The callback + * has to be called with an response object. + */ + onBeforeSendHeaders(filter: OnBeforeSendHeadersFilter, listener: Function): void; + /** + * The listener will be called with listener(details) when a request is completed. + */ + onCompleted(filter: OnCompletedFilter, listener: (details?: OnCompletedDetails) => void): void; + /** + * The listener will be called with listener(details) when an error occurs. + */ + onErrorOccurred(filter: OnErrorOccurredFilter, listener: (details?: OnErrorOccurredDetails) => void): void; + /** + * The listener will be called with listener(details, callback) when HTTP response + * headers of a request have been received. The callback has to be called with an + * response object. + */ + onHeadersReceived(filter: OnHeadersReceivedFilter, listener: Function): void; + /** + * The listener will be called with listener(details) when first byte of the + * response body is received. For HTTP requests, this means that the status line + * and response headers are available. + */ + onResponseStarted(filter: OnResponseStartedFilter, listener: (details?: OnResponseStartedDetails) => void): void; + /** + * The listener will be called with listener(details) just before a request is + * going to be sent to the server, modifications of previous onBeforeSendHeaders + * response are visible by the time this listener is fired. + */ + onSendHeaders(filter: OnSendHeadersFilter, listener: (details?: OnSendHeadersDetails) => void): void; + } + + interface WebviewTag extends HTMLElement { + + // Docs: http://electron.atom.io/docs/api/webview-tag + + /** + * Fired when a load has committed. This includes navigation within the current + * document as well as subframe document-level loads, but does not include + * asynchronous resource loads. + */ + addEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void): this; + /** + * Fired when the navigation is done, i.e. the spinner of the tab will stop + * spinning, and the onload event is dispatched. + */ + addEventListener(event: 'did-finish-load', listener: (event: Event) => void, useCapture?: boolean): this; + removeEventListener(event: 'did-finish-load', listener: (event: Event) => void): this; + /** + * This event is like did-finish-load, but fired when the load failed or was + * cancelled, e.g. window.stop() is invoked. + */ + addEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void): this; + /** + * Fired when a frame has done navigation. + */ + addEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void): this; + /** + * Corresponds to the points in time when the spinner of the tab starts spinning. + */ + addEventListener(event: 'did-start-loading', listener: (event: Event) => void, useCapture?: boolean): this; + removeEventListener(event: 'did-start-loading', listener: (event: Event) => void): this; + /** + * Corresponds to the points in time when the spinner of the tab stops spinning. + */ + addEventListener(event: 'did-stop-loading', listener: (event: Event) => void, useCapture?: boolean): this; + removeEventListener(event: 'did-stop-loading', listener: (event: Event) => void): this; + /** + * Fired when details regarding a requested resource is available. status indicates + * socket connection to download the resource. + */ + addEventListener(event: 'did-get-response-details', listener: (event: DidGetResponseDetailsEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'did-get-response-details', listener: (event: DidGetResponseDetailsEvent) => void): this; + /** + * Fired when a redirect was received while requesting a resource. + */ + addEventListener(event: 'did-get-redirect-request', listener: (event: DidGetRedirectRequestEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'did-get-redirect-request', listener: (event: DidGetRedirectRequestEvent) => void): this; + /** + * Fired when document in the given frame is loaded. + */ + addEventListener(event: 'dom-ready', listener: (event: Event) => void, useCapture?: boolean): this; + removeEventListener(event: 'dom-ready', listener: (event: Event) => void): this; + /** + * Fired when page title is set during navigation. explicitSet is false when title + * is synthesized from file url. + */ + addEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void): this; + /** + * Fired when page receives favicon urls. + */ + addEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void): this; + /** + * Fired when page enters fullscreen triggered by HTML API. + */ + addEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this; + removeEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void): this; + /** + * Fired when page leaves fullscreen triggered by HTML API. + */ + addEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this; + removeEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void): this; + /** + * Fired when the guest window logs a console message. The following example code + * forwards all log messages to the embedder's console without regard for log level + * or other properties. + */ + addEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void): this; + /** + * Fired when a result is available for webview.findInPage request. + */ + addEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void): this; + /** + * Fired when the guest page attempts to open a new browser window. The following + * example code opens the new url in system's default browser. + */ + addEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void): this; + /** + * Emitted when a user or the page wants to start navigation. It can happen when + * the window.location object is changed or a user clicks a link in the page. This + * event will not emit when the navigation is started programmatically with APIs + * like .loadURL and .back. It is also not emitted during in-page + * navigation, such as clicking anchor links or updating the window.location.hash. + * Use did-navigate-in-page event for this purpose. Calling event.preventDefault() + * does NOT have any effect. + */ + addEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void): this; + /** + * Emitted when a navigation is done. This event is not emitted for in-page + * navigations, such as clicking anchor links or updating the window.location.hash. + * Use did-navigate-in-page event for this purpose. + */ + addEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void): this; + /** + * Emitted when an in-page navigation happened. When in-page navigation happens, + * the page URL changes but does not cause navigation outside of the page. Examples + * of this occurring are when anchor links are clicked or when the DOM hashchange + * event is triggered. + */ + addEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void): this; + /** + * Fired when the guest page attempts to close itself. The following example code + * navigates the webview to about:blank when the guest attempts to close itself. + */ + addEventListener(event: 'close', listener: (event: Event) => void, useCapture?: boolean): this; + removeEventListener(event: 'close', listener: (event: Event) => void): this; + /** + * Fired when the guest page has sent an asynchronous message to embedder page. + * With sendToHost method and ipc-message event you can easily communicate between + * guest page and embedder page: + */ + addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this; + /** + * Fired when the renderer process is crashed. + */ + addEventListener(event: 'crashed', listener: (event: Event) => void, useCapture?: boolean): this; + removeEventListener(event: 'crashed', listener: (event: Event) => void): this; + /** + * Fired when the gpu process is crashed. + */ + addEventListener(event: 'gpu-crashed', listener: (event: Event) => void, useCapture?: boolean): this; + removeEventListener(event: 'gpu-crashed', listener: (event: Event) => void): this; + /** + * Fired when a plugin process is crashed. + */ + addEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void): this; + /** + * Fired when the WebContents is destroyed. + */ + addEventListener(event: 'destroyed', listener: (event: Event) => void, useCapture?: boolean): this; + removeEventListener(event: 'destroyed', listener: (event: Event) => void): this; + /** + * Emitted when media starts playing. + */ + addEventListener(event: 'media-started-playing', listener: (event: Event) => void, useCapture?: boolean): this; + removeEventListener(event: 'media-started-playing', listener: (event: Event) => void): this; + /** + * Emitted when media is paused or done playing. + */ + addEventListener(event: 'media-paused', listener: (event: Event) => void, useCapture?: boolean): this; + removeEventListener(event: 'media-paused', listener: (event: Event) => void): this; + /** + * Emitted when a page's theme color changes. This is usually due to encountering a + * meta tag: + */ + addEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void): this; + /** + * Emitted when mouse moves over a link or the keyboard moves the focus to a link. + */ + addEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void, useCapture?: boolean): this; + removeEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void): this; + /** + * Emitted when DevTools is opened. + */ + addEventListener(event: 'devtools-opened', listener: (event: Event) => void, useCapture?: boolean): this; + removeEventListener(event: 'devtools-opened', listener: (event: Event) => void): this; + /** + * Emitted when DevTools is closed. + */ + addEventListener(event: 'devtools-closed', listener: (event: Event) => void, useCapture?: boolean): this; + removeEventListener(event: 'devtools-closed', listener: (event: Event) => void): this; + /** + * Emitted when DevTools is focused / opened. + */ + addEventListener(event: 'devtools-focused', listener: (event: Event) => void, useCapture?: boolean): this; + removeEventListener(event: 'devtools-focused', listener: (event: Event) => void): this; + canGoBack(): boolean; + canGoForward(): boolean; + canGoToOffset(offset: number): boolean; + /** + * Captures a snapshot of the webview's page. Same as + * webContents.capturePage([rect, ]callback). + */ + capturePage(callback: (image?: NativeImage) => void): void; + /** + * Captures a snapshot of the webview's page. Same as + * webContents.capturePage([rect, ]callback). + */ + capturePage(rect: Rectangle, callback: (image?: NativeImage) => void): void; + /** + * Clears the navigation history. + */ + clearHistory(): void; + /** + * Closes the DevTools window of guest page. + */ + closeDevTools(): void; + /** + * Executes editing command copy in page. + */ + copy(): void; + /** + * Executes editing command cut in page. + */ + cut(): void; + /** + * Executes editing command delete in page. + */ + delete(): void; + /** + * Evaluates code in page. If userGesture is set, it will create the user gesture + * context in the page. HTML APIs like requestFullScreen, which require user + * action, can take advantage of this option for automation. + */ + executeJavaScript(code: string, userGesture: boolean, callback?: (result?: any) => void): void; + /** + * Starts a request to find all matches for the text in the web page and returns an + * Integer representing the request id used for the request. The result of the + * request can be obtained by subscribing to found-in-page event. + */ + findInPage(text: string, options?: FindInPageOptions): void; + getTitle(): string; + getURL(): string; + getUserAgent(): string; + getWebContents(): WebContents; + /** + * Makes the guest page go back. + */ + goBack(): void; + /** + * Makes the guest page go forward. + */ + goForward(): void; + /** + * Navigates to the specified absolute index. + */ + goToIndex(index: number): void; + /** + * Navigates to the specified offset from the "current entry". + */ + goToOffset(offset: number): void; + /** + * Injects CSS into the guest page. + */ + insertCSS(css: string): void; + /** + * Inserts text to the focused element. + */ + insertText(text: string): void; + /** + * Starts inspecting element at position (x, y) of guest page. + */ + inspectElement(x: number, y: number): void; + /** + * Opens the DevTools for the service worker context present in the guest page. + */ + inspectServiceWorker(): void; + isAudioMuted(): boolean; + isCrashed(): boolean; + isDevToolsFocused(): boolean; + isDevToolsOpened(): boolean; + isLoading(): boolean; + isWaitingForResponse(): boolean; + /** + * Loads the url in the webview, the url must contain the protocol prefix, e.g. the + * http:// or file://. + */ + loadURL(url: string, options?: LoadURLOptions): void; + /** + * Opens a DevTools window for guest page. + */ + openDevTools(): void; + /** + * Executes editing command paste in page. + */ + paste(): void; + /** + * Executes editing command pasteAndMatchStyle in page. + */ + pasteAndMatchStyle(): void; + /** + * Prints webview's web page. Same as webContents.print([options]). + */ + print(options?: PrintOptions): void; + /** + * Prints webview's web page as PDF, Same as webContents.printToPDF(options, + * callback). + */ + printToPDF(options: PrintToPDFOptions, callback: (error?: Error, data?: Buffer) => void): void; + /** + * Executes editing command redo in page. + */ + redo(): void; + /** + * Reloads the guest page. + */ + reload(): void; + /** + * Reloads the guest page and ignores cache. + */ + reloadIgnoringCache(): void; + /** + * Executes editing command replace in page. + */ + replace(text: string): void; + /** + * Executes editing command replaceMisspelling in page. + */ + replaceMisspelling(text: string): void; + /** + * Executes editing command selectAll in page. + */ + selectAll(): void; + /** + * Send an asynchronous message to renderer process via channel, you can also send + * arbitrary arguments. The renderer process can handle the message by listening to + * the channel event with the ipcRenderer module. See webContents.send for + * examples. + */ + send(channel: string, ...args: any[]): void; + /** + * Sends an input event to the page. See webContents.sendInputEvent for detailed + * description of event object. + */ + sendInputEvent(event: any): void; + /** + * Set guest page muted. + */ + setAudioMuted(muted: boolean): void; + /** + * Overrides the user agent for the guest page. + */ + setUserAgent(userAgent: string): void; + /** + * Changes the zoom factor to the specified factor. Zoom factor is zoom percent + * divided by 100, so 300% = 3.0. + */ + setZoomFactor(factor: number): void; + /** + * Changes the zoom level to the specified level. The original size is 0 and each + * increment above or below represents zooming 20% larger or smaller to default + * limits of 300% and 50% of original size, respectively. + */ + setZoomLevel(level: number): void; + /** + * Shows pop-up dictionary that searches the selected word on the page. + */ + showDefinitionForSelection(): void; + /** + * Stops any pending navigation. + */ + stop(): void; + /** + * Stops any findInPage request for the webview with the provided action. + */ + stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void; + /** + * Executes editing command undo in page. + */ + undo(): void; + /** + * Executes editing command unselect in page. + */ + unselect(): void; + /** + * When this attribute is present the guest page will be allowed to open new + * windows. Popups are disabled by default. + */ + allowpopups?: string; + /** + * When this attribute is present the webview container will automatically resize + * within the bounds specified by the attributes minwidth, minheight, maxwidth, and + * maxheight. These constraints do not impact the webview unless autosize is + * enabled. When autosize is enabled, the webview container size cannot be less + * than the minimum values or greater than the maximum. + */ + autosize?: string; + /** + * A list of strings which specifies the blink features to be enabled separated by + * ,. The full list of supported feature strings can be found in the + * RuntimeEnabledFeatures.json5 file. + */ + blinkfeatures?: string; + /** + * A list of strings which specifies the blink features to be disabled separated by + * ,. The full list of supported feature strings can be found in the + * RuntimeEnabledFeatures.json5 file. + */ + disableblinkfeatures?: string; + /** + * When this attribute is present the webview contents will be prevented from + * resizing when the webview element itself is resized. This can be used in + * combination with webContents.setSize to manually resize the webview contents in + * reaction to a window size change. This can make resizing faster compared to + * relying on the webview element bounds to automatically resize the contents. + */ + disableguestresize?: string; + /** + * When this attribute is present the guest page will have web security disabled. + * Web security is enabled by default. + */ + disablewebsecurity?: string; + /** + * A value that links the webview to a specific webContents. When a webview first + * loads a new webContents is created and this attribute is set to its instance + * identifier. Setting this attribute on a new or existing webview connects it to + * the existing webContents that currently renders in a different webview. The + * existing webview will see the destroy event and will then create a new + * webContents when a new url is loaded. + */ + guestinstance?: string; + /** + * Sets the referrer URL for the guest page. + */ + httpreferrer?: string; + /** + * When this attribute is present the guest page in webview will have node + * integration and can use node APIs like require and process to access low level + * system resources. Node integration is disabled by default in the guest page. + */ + nodeintegration?: string; + /** + * Sets the session used by the page. If partition starts with persist:, the page + * will use a persistent session available to all pages in the app with the same + * partition. if there is no persist: prefix, the page will use an in-memory + * session. By assigning the same partition, multiple pages can share the same + * session. If the partition is unset then default session of the app will be used. + * This value can only be modified before the first navigation, since the session + * of an active renderer process cannot change. Subsequent attempts to modify the + * value will fail with a DOM exception. + */ + partition?: string; + /** + * When this attribute is present the guest page in webview will be able to use + * browser plugins. Plugins are disabled by default. + */ + plugins?: string; + /** + * Specifies a script that will be loaded before other scripts run in the guest + * page. The protocol of script's URL must be either file: or asar:, because it + * will be loaded by require in guest page under the hood. When the guest page + * doesn't have node integration this script will still have access to all Node + * APIs, but global objects injected by Node will be deleted after this script has + * finished executing. + */ + preload?: string; + /** + * Returns the visible URL. Writing to this attribute initiates top-level + * navigation. Assigning src its own value will reload the current page. The src + * attribute can also accept data URLs, such as data:text/plain,Hello, world!. + */ + src?: string; + /** + * Sets the user agent for the guest page before the page is navigated to. Once the + * page is loaded, use the setUserAgent method to change the user agent. + */ + useragent?: string; + /** + * A list of strings which specifies the web preferences to be set on the webview, + * separated by ,. The full list of supported preference strings can be found in + * BrowserWindow. The string follows the same format as the features string in + * window.open. A name by itself is given a true boolean value. A preference can be + * set to another value by including an =, followed by the value. Special values + * yes and 1 are interpreted as true, while no and 0 are interpreted as false. + */ + webpreferences?: string; } interface AboutPanelOptionsOptions { @@ -3368,7 +5605,7 @@ declare namespace Electron { /** * The scale factor to add the image representation for. */ - scaleFactor: number; + scaleFactor?: number; /** * Defaults to 0. Required if a bitmap buffer is specified as . */ @@ -3411,11 +5648,22 @@ declare namespace Electron { } interface AuthInfo { - isProxy: boolean; - scheme: string; - host: string; - port: number; - realm: string; + isProxy?: boolean; + scheme?: string; + host?: string; + port?: number; + realm?: string; + } + + interface AutoResizeOptions { + /** + * default. + */ + false?: by; + /** + * default. + */ + false?: by; } interface BitmapOptions { @@ -3425,6 +5673,13 @@ declare namespace Electron { scaleFactor?: number; } + interface BrowserViewConstructorOptions { + /** + * See . + */ + webPreferences?: WebPreferences; + } + interface BrowserWindowConstructorOptions { /** * Window's width in pixels. Default is . @@ -3435,12 +5690,12 @@ declare namespace Electron { */ height?: number; /** - * ( if y is used) - Window's left offset from screen. Default is to center the + * ( if y is used) Window's left offset from screen. Default is to center the * window. */ x?: number; /** - * ( if x is used) - Window's top offset from screen. Default is to center the + * ( if x is used) Window's top offset from screen. Default is to center the * window. */ y?: number; @@ -3587,7 +5842,7 @@ declare namespace Electron { /** * The style of window title bar. Default is . Possible values are: */ - titleBarStyle?: string; + titleBarStyle?: ('default' | 'hidden' | 'hidden-inset'); /** * Use style for frameless windows on Windows, which adds standard window frame. * Setting it to will remove window shadow and window animations. Default is . @@ -3597,7 +5852,7 @@ declare namespace Electron { * Add a type of vibrancy effect to the window, only on macOS. Can be , , , , , , , * , or . */ - vibrancy?: string; + vibrancy?: ('appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark'); /** * Controls the behavior on macOS when option-clicking the green stoplight button * on the toolbar or by clicking the Window > Zoom menu item. If , the window will @@ -3606,34 +5861,50 @@ declare namespace Electron { * directly. Default is . */ zoomToPageWidth?: boolean; + /** + * Tab group name, allows opening the window as a native tab on macOS 10.12+. + * Windows with the same tabbing identifier will be grouped together. + */ + tabbingIdentifier?: string; /** * Settings of web page's features. */ webPreferences?: WebPreferences; } + interface CertificateTrustDialogOptions { + /** + * The certificate to trust/import. + */ + certificate?: Certificate; + /** + * The message to display to the user. + */ + message?: string; + } + interface CertificateVerifyProcRequest { - hostname: string; - certificate: Certificate; + hostname?: string; + certificate?: Certificate; /** * Verification result from chromium. */ - error: string; + error?: string; } interface ClearStorageDataOptions { /** * Should follow ’s representation . */ - origin: string; + origin?: string; /** * The types of storages to clear, can contain: , , , , , , , */ - storages: string[]; + storages?: string[]; /** * The types of quotas to clear, can contain: , , . */ - quotas: string[]; + quotas?: string[]; } interface CommandLine { @@ -3647,101 +5918,108 @@ declare namespace Electron { * Append an argument to Chromium's command line. The argument will be quoted * correctly. Note: This will not affect process.argv. */ - appendArgument: (value: string) => void; + appendArgument?: (value: string) => void; } interface Config { /** * The URL associated with the PAC file. */ - pacScript: string; + pacScript?: string; /** * Rules indicating which proxies to use. */ - proxyRules: string; + proxyRules?: string; /** * Rules indicating which URLs should bypass the proxy settings. */ - proxyBypassRules: string; + proxyBypassRules?: string; + } + + interface ConsoleMessageEvent extends Event { + level?: number; + message?: string; + line?: number; + sourceId?: string; } interface ContextMenuParams { /** * x coordinate */ - x: number; + x?: number; /** * y coordinate */ - y: number; + y?: number; /** * URL of the link that encloses the node the context menu was invoked on. */ - linkURL: string; + linkURL?: string; /** * Text associated with the link. May be an empty string if the contents of the * link are an image. */ - linkText: string; + linkText?: string; /** * URL of the top level page that the context menu was invoked on. */ - pageURL: string; + pageURL?: string; /** * URL of the subframe that the context menu was invoked on. */ - frameURL: string; + frameURL?: string; /** * Source URL for the element that the context menu was invoked on. Elements with * source URLs are images, audio and video. */ - srcURL: string; + srcURL?: string; /** * Type of the node the context menu was invoked on. Can be , , , , , or . */ - mediaType: string; + mediaType?: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin'); /** * Whether the context menu was invoked on an image which has non-empty contents. */ - hasImageContents: boolean; + hasImageContents?: boolean; /** * Whether the context is editable. */ - isEditable: boolean; + isEditable?: boolean; /** * Text of the selection that the context menu was invoked on. */ - selectionText: string; + selectionText?: string; /** * Title or alt text of the selection that the context was invoked on. */ - titleText: string; + titleText?: string; /** * The misspelled word under the cursor, if any. */ - misspelledWord: string; + misspelledWord?: string; /** * The character encoding of the frame on which the menu was invoked. */ - frameCharset: string; + frameCharset?: string; /** * If the context menu was invoked on an input field, the type of that field. * Possible values are , , , . */ - inputFieldType: string; + inputFieldType?: string; /** * Input source that invoked the context menu. Can be , , , , . */ - menuSourceType: string; + menuSourceType?: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu'); /** * The flags for the media element the context menu was invoked on. */ - mediaFlags: MediaFlags; + mediaFlags?: MediaFlags; /** * These flags indicate whether the renderer believes it is able to perform the * corresponding action. */ - editFlags: EditFlags; + editFlags?: EditFlags; } interface CrashReporterStartOptions { @@ -3749,7 +6027,7 @@ declare namespace Electron { /** * URL that crash reports will be sent to as POST. */ - submitURL: string; + submitURL?: string; /** * Defaults to . */ @@ -3788,39 +6066,34 @@ declare namespace Electron { /** * Absolute path of the download. */ - path: string; + path?: string; /** * Complete URL chain for the download. */ - urlChain: string[]; + urlChain?: string[]; mimeType?: string; /** * Start range for the download. */ - offset: number; + offset?: number; /** * Total length of the download. */ - length: number; + length?: number; /** * Last-Modified header value. */ - lastModified: string; + lastModified?: string; /** * ETag header value. */ - eTag: string; + eTag?: string; /** * Time when download was started in number of seconds since UNIX epoch. */ startTime?: number; } - interface CursorScreenPoint { - x: number; - y: number; - } - interface Data { text?: string; html?: string; @@ -3836,7 +6109,7 @@ declare namespace Electron { /** * The url to associate the cookie with. */ - url: string; + url?: string; /** * The name of the cookie. Empty by default if omitted. */ @@ -3872,6 +6145,47 @@ declare namespace Electron { interface DevToolsExtensions { } + interface DidChangeThemeColorEvent extends Event { + themeColor?: string; + } + + interface DidFailLoadEvent extends Event { + errorCode?: number; + errorDescription?: string; + validatedURL?: string; + isMainFrame?: boolean; + } + + interface DidFrameFinishLoadEvent extends Event { + isMainFrame?: boolean; + } + + interface DidGetRedirectRequestEvent extends Event { + oldURL?: string; + newURL?: string; + isMainFrame?: boolean; + } + + interface DidGetResponseDetailsEvent extends Event { + status?: boolean; + newURL?: string; + originalURL?: string; + httpResponseCode?: number; + requestMethod?: string; + referrer?: string; + headers?: Headers; + resourceType?: string; + } + + interface DidNavigateEvent extends Event { + url?: string; + } + + interface DidNavigateInPageEvent extends Event { + isMainFrame?: boolean; + url?: string; + } + interface DisplayBalloonOptions { icon?: NativeImage | string; title?: string; @@ -3885,37 +6199,37 @@ declare namespace Electron { * dock icon will bounce for one second. However, the request remains active until * either the application becomes active or the request is canceled. */ - bounce: (type?: 'critical' | 'informational') => number; + bounce?: (type?: 'critical' | 'informational') => number; /** * Cancel the bounce of id. */ - cancelBounce: (id: number) => void; + cancelBounce?: (id: number) => void; /** * Bounces the Downloads stack if the filePath is inside the Downloads folder. */ - downloadFinished: (filePath: string) => void; + downloadFinished?: (filePath: string) => void; /** * Sets the string to be displayed in the dock’s badging area. */ - setBadge: (text: string) => void; - getBadge: () => string; + setBadge?: (text: string) => void; + getBadge?: () => string; /** * Hides the dock icon. */ - hide: () => void; + hide?: () => void; /** * Shows the dock icon. */ - show: () => void; - isVisible: () => boolean; + show?: () => void; + isVisible?: () => boolean; /** * Sets the application's dock menu. */ - setMenu: (menu: Menu) => void; + setMenu?: (menu: Menu) => void; /** * Sets the image associated with this dock icon. */ - setIcon: (image: NativeImage | string) => void; + setIcon?: (image: NativeImage | string) => void; } interface EnableNetworkEmulationOptions { @@ -3937,13 +6251,8 @@ declare namespace Electron { uploadThroughput?: number; } - interface ExtraSize { - width: number; - height: number; - } - interface FileIconOptions { - size: string; + size?: ('small' | 'normal' | 'large'); } interface Filter { @@ -3999,107 +6308,105 @@ declare namespace Electron { medialCapitalAsWordStart?: boolean; } + interface FoundInPageEvent extends Event { + result?: FoundInPageResult; + } + interface FromPartitionOptions { /** * Whether to enable cache. */ - cache: boolean; - } - - interface Hotspot { - /** - * x coordinate - */ - x: number; - /** - * y coordinate - */ - y: number; + cache?: boolean; } interface ImportCertificateOptions { /** * Path for the pkcs12 file. */ - certificate: string; + certificate?: string; /** * Passphrase for the certificate. */ - password: string; + password?: string; } interface Input { /** * Either or */ - type: string; + type?: string; /** * Equivalent to */ - key: string; + key?: string; /** * Equivalent to */ - code: string; + code?: string; /** * Equivalent to */ - isAutoRepeat: boolean; + isAutoRepeat?: boolean; /** * Equivalent to */ - shift: boolean; + shift?: boolean; /** * Equivalent to */ - control: boolean; + control?: boolean; /** * Equivalent to */ - alt: boolean; + alt?: boolean; /** * Equivalent to */ - meta: boolean; + meta?: boolean; } interface InterceptBufferProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; + url?: string; + referrer?: string; + method?: string; + uploadData?: UploadData[]; } interface InterceptFileProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; + url?: string; + referrer?: string; + method?: string; + uploadData?: UploadData[]; } interface InterceptHttpProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; + url?: string; + referrer?: string; + method?: string; + uploadData?: UploadData[]; } interface InterceptStringProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; + url?: string; + referrer?: string; + method?: string; + uploadData?: UploadData[]; + } + + interface IpcMessageEvent extends Event { + channel?: string; + args?: any[]; } interface Item { /** - * or Array - The path(s) to the file(s) being dragged. + * or Array The path(s) to the file(s) being dragged. */ - file: string; + file?: string; /** * The image must be non-empty on macOS. */ - icon: NativeImage; + icon?: NativeImage; } interface JumpListSettings { @@ -4107,14 +6414,19 @@ declare namespace Electron { * The minimum number of items that will be shown in the Jump List (for a more * detailed description of this value see the ). */ - minItems: number; + minItems?: number; /** * Array of objects that correspond to items that the user has explicitly removed * from custom categories in the Jump List. These items must not be re-added to the * Jump List in the call to , Windows will not display any custom category that * contains any of the removed items. */ - removedItems: JumpListItem[]; + removedItems?: JumpListItem[]; + } + + interface LoadCommitEvent extends Event { + url?: string; + isMainFrame?: boolean; } interface LoadURLOptions { @@ -4130,9 +6442,6 @@ declare namespace Electron { * Extra headers separated by "\n" */ extraHeaders?: string; - /** - * [] - (optional) - */ postData?: UploadRawData | UploadFile | UploadFileSystem | UploadBlob; /** * Base url (with trailing path separator) for files to be loaded by the data url. @@ -4147,29 +6456,29 @@ declare namespace Electron { /** * if the app is set to open at login. */ - openAtLogin: boolean; + openAtLogin?: boolean; /** * if the app is set to open as hidden at login. This setting is only supported on * macOS. */ - openAsHidden: boolean; + openAsHidden?: boolean; /** * if the app was opened at login automatically. This setting is only supported on * macOS. */ - wasOpenedAtLogin: boolean; + wasOpenedAtLogin?: boolean; /** * if the app was opened as a hidden login item. This indicates that the app should * not open any windows at startup. This setting is only supported on macOS. */ - wasOpenedAsHidden: boolean; + wasOpenedAsHidden?: boolean; /** * if the app was opened as a login item that should restore the state from the * previous session. This indicates that the app should restore the windows that * were open the last time the app was closed. This setting is only supported on * macOS. */ - restoreState: boolean; + restoreState?: boolean; } interface LoginItemSettingsOptions { @@ -4187,15 +6496,16 @@ declare namespace Electron { /** * Will be called with when the menu item is clicked. */ - click?: (menuItem: MenuItem, browserWindow: BrowserWindow, event: Event) => void; + click?: (menuItem?: MenuItem, browserWindow?: BrowserWindow, event?: Event) => void; /** * Define the action of the menu item, when specified the property will be ignored. + * See . */ role?: string; /** * Can be , , , or . */ - type?: string; + type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio'); label?: string; sublabel?: string; accelerator?: Accelerator; @@ -4231,8 +6541,8 @@ declare namespace Electron { interface MessageBoxOptions { /** - * Can be , , , or . On Windows, "question" displays the same icon as "info", - * unless you set an icon using the "icon" option. + * Can be , , , or . On Windows, displays the same icon as , unless you set an icon + * using the option. On macOS, both and display the same warning icon. */ type?: string; /** @@ -4252,7 +6562,7 @@ declare namespace Electron { /** * Content of the message box. */ - message: string; + message?: string; /** * Extra information of the message. */ @@ -4281,6 +6591,167 @@ declare namespace Electron { * don't like this behavior, you can set to . */ noLink?: boolean; + /** + * Normalize the keyboard access keys across platforms. Default is . Enabling this + * assumes is used in the button labels for the placement of the keyboard shortcut + * access key and labels will be converted so they work correctly on each platform, + * characters are removed on macOS, converted to on Linux, and left untouched on + * Windows. For example, a button label of will be converted to on Linux and on + * macOS and can be selected via on Windows and Linux. + */ + normalizeAccessKeys?: boolean; + } + + interface NewWindowEvent extends Event { + url?: string; + frameName?: string; + /** + * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, + * `save-to-disk` and `other`. + */ + disposition?: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'); + /** + * The options which should be used for creating the new `BrowserWindow`. + */ + options?: Options; + } + + interface OnBeforeRedirectDetails { + id?: string; + url?: string; + method?: string; + resourceType?: string; + timestamp?: number; + redirectURL?: string; + statusCode?: number; + /** + * The server IP address that the request was actually sent to. + */ + ip?: string; + fromCache?: boolean; + responseHeaders?: ResponseHeaders; + } + + interface OnBeforeRedirectFilter { + /** + * Array of URL patterns that will be used to filter out the requests that do not + * match the URL patterns. + */ + urls?: string[]; + } + + interface OnBeforeRequestDetails { + id?: number; + url?: string; + method?: string; + resourceType?: string; + timestamp?: number; + uploadData?: UploadData[]; + } + + interface OnBeforeRequestFilter { + /** + * Array of URL patterns that will be used to filter out the requests that do not + * match the URL patterns. + */ + urls?: string[]; + } + + interface OnBeforeSendHeadersFilter { + /** + * Array of URL patterns that will be used to filter out the requests that do not + * match the URL patterns. + */ + urls?: string[]; + } + + interface OnCompletedDetails { + id?: number; + url?: string; + method?: string; + resourceType?: string; + timestamp?: number; + responseHeaders?: ResponseHeaders; + fromCache?: boolean; + statusCode?: number; + statusLine?: string; + } + + interface OnCompletedFilter { + /** + * Array of URL patterns that will be used to filter out the requests that do not + * match the URL patterns. + */ + urls?: string[]; + } + + interface OnErrorOccurredDetails { + id?: number; + url?: string; + method?: string; + resourceType?: string; + timestamp?: number; + fromCache?: boolean; + /** + * The error description. + */ + error?: string; + } + + interface OnErrorOccurredFilter { + /** + * Array of URL patterns that will be used to filter out the requests that do not + * match the URL patterns. + */ + urls?: string[]; + } + + interface OnHeadersReceivedFilter { + /** + * Array of URL patterns that will be used to filter out the requests that do not + * match the URL patterns. + */ + urls?: string[]; + } + + interface OnResponseStartedDetails { + id?: number; + url?: string; + method?: string; + resourceType?: string; + timestamp?: number; + responseHeaders?: ResponseHeaders; + /** + * Indicates whether the response was fetched from disk cache. + */ + fromCache?: boolean; + statusCode?: number; + statusLine?: string; + } + + interface OnResponseStartedFilter { + /** + * Array of URL patterns that will be used to filter out the requests that do not + * match the URL patterns. + */ + urls?: string[]; + } + + interface OnSendHeadersDetails { + id?: number; + url?: string; + method?: string; + resourceType?: string; + timestamp?: number; + requestHeaders?: RequestHeaders; + } + + interface OnSendHeadersFilter { + /** + * Array of URL patterns that will be used to filter out the requests that do not + * match the URL patterns. + */ + urls?: string[]; } interface OpenDevToolsOptions { @@ -4288,7 +6759,7 @@ declare namespace Electron { * Opens the devtools with specified dock state, can be , , , . Defaults to last * used dock state. In mode it's possible to dock back. In mode it's not. */ - mode: string; + mode?: ('right' | 'bottom' | 'undocked' | 'detach'); } interface OpenDialogOptions { @@ -4304,67 +6775,74 @@ declare namespace Electron { * Contains which features the dialog should use. The following values are * supported: */ - properties?: string[]; + properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases'>; /** - * Normalize the keyboard access keys across platforms. Default is . Enabling this - * assumes is used in the button labels for the placement of the keyboard shortcut - * access key and labels will be converted so they work correctly on each platform, - * characters are removed on macOS, converted to on Linux, and left untouched on - * Windows. For example, a button label of will be converted to on Linux and on - * macOS and can be selected via on Windows and Linux. + * Message to display above input boxes. */ - normalizeAccessKeys?: boolean; + message?: string; } interface OpenExternalOptions { /** * to bring the opened application to the foreground. The default is . */ - activate: boolean; + activate?: boolean; + } + + interface PageFaviconUpdatedEvent extends Event { + /** + * Array of URLs. + */ + favicons?: string[]; + } + + interface PageTitleUpdatedEvent extends Event { + title?: string; + explicitSet?: boolean; } interface Parameters { /** * Specify the screen type to emulate (default: ) */ - screenPosition: string; + screenPosition?: ('desktop' | 'mobile'); /** * Set the emulated screen size (screenPosition == mobile) */ - screenSize: ScreenSize; + screenSize?: Size; /** * Position the view on the screen (screenPosition == mobile) (default: ) */ - viewPosition: ViewPosition; + viewPosition?: Point; /** * Set the device scale factor (if zero defaults to original device scale factor) * (default: ) */ - deviceScaleFactor: number; + deviceScaleFactor?: number; /** * Set the emulated view size (empty means no override) */ - viewSize: ViewSize; + viewSize?: Size; /** * Whether emulated view should be scaled down if necessary to fit into available * space (default: ) */ - fitToView: boolean; + fitToView?: boolean; /** * Offset of the emulated view inside available space (not in fit to view mode) * (default: ) */ - offset: Offset; + offset?: Point; /** * Scale of emulated view inside available space (not in fit to view mode) * (default: ) */ - scale: number; + scale?: number; } - interface Point { - x: number; - y: number; + interface PluginCrashedEvent extends Event { + name?: string; + version?: string; } interface PopupOptions { @@ -4373,7 +6851,7 @@ declare namespace Electron { */ x?: number; /** - * ( if is used) - Default is the current mouse cursor position. + * ( if is used) Default is the current mouse cursor position. */ y?: number; /** @@ -4388,20 +6866,15 @@ declare namespace Electron { positioningItem?: number; } - interface Position { - x: number; - y: number; - } - interface PrintOptions { /** * Don't ask user for print settings. Default is . */ - silent: boolean; + silent?: boolean; /** * Also prints the background color and image of the web page. Default is . */ - printBackground: boolean; + printBackground?: boolean; } interface PrintToPDFOptions { @@ -4433,75 +6906,68 @@ declare namespace Electron { /** * The amount of memory currently pinned to actual physical RAM. */ - workingSetSize: number; + workingSetSize?: number; /** * The maximum amount of memory that has ever been pinned to actual physical RAM. */ - peakWorkingSetSize: number; + peakWorkingSetSize?: number; /** * The amount of memory not shared by other processes, such as JS heap or HTML * content. */ - privateBytes: number; + privateBytes?: number; /** * The amount of memory shared between processes, typically memory consumed by the * Electron code itself */ - sharedBytes: number; + sharedBytes?: number; } interface ProgressBarOptions { /** - * - Mode for the progress bar. Can be , , , , or . + * Mode for the progress bar. Can be , , , , or . */ - mode: string; + mode?: ('none' | 'normal' | 'indeterminate' | 'error'); } interface Provider { /** * Returns */ - spellCheck: (text: string) => void; + spellCheck?: (text?: string) => void; } interface ReadBookmark { - title: string; - url: string; - } - - interface Rect { - x: number; - y: number; - width: number; - height: number; + title?: string; + url?: string; } interface RedirectRequest { - url: string; - method: string; + url?: string; + method?: string; session?: Session; uploadData?: UploadData; } interface RegisterBufferProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; + url?: string; + referrer?: string; + method?: string; + uploadData?: UploadData[]; } interface RegisterFileProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; + url?: string; + referrer?: string; + method?: string; + uploadData?: UploadData[]; } interface RegisterHttpProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; + url?: string; + referrer?: string; + method?: string; + uploadData?: UploadData[]; } interface RegisterStandardSchemesOptions { @@ -4512,10 +6978,10 @@ declare namespace Electron { } interface RegisterStringProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; + url?: string; + referrer?: string; + method?: string; + uploadData?: UploadData[]; } interface RegisterURLSchemeAsPrivilegedOptions { @@ -4547,9 +7013,9 @@ declare namespace Electron { } interface Request { - method: string; - url: URL; - referrer: URL; + method?: string; + url?: string; + referrer?: string; } interface ResizeOptions { @@ -4572,27 +7038,37 @@ declare namespace Electron { } interface ResourceUsage { - images: MemoryUsageDetails; - cssStyleSheets: MemoryUsageDetails; - xslStyleSheets: MemoryUsageDetails; - fonts: MemoryUsageDetails; - other: MemoryUsageDetails; + images?: MemoryUsageDetails; + cssStyleSheets?: MemoryUsageDetails; + xslStyleSheets?: MemoryUsageDetails; + fonts?: MemoryUsageDetails; + other?: MemoryUsageDetails; + } + + interface Response { + cancel?: boolean; + /** + * The original request is prevented from being sent or completed and is instead + * redirected to the given URL. + */ + redirectURL?: string; } interface Result { - requestId: number; + requestId?: number; /** * Position of the active match. */ - activeMatchOrdinal: number; + activeMatchOrdinal?: number; /** * Number of Matches. */ - matches: number; + matches?: number; /** * Coordinates of first match region. */ - selectionArea: SelectionArea; + selectionArea?: SelectionArea; + finalUpdate?: boolean; } interface SaveDialogOptions { @@ -4631,11 +7107,6 @@ declare namespace Electron { openAsHidden?: boolean; } - interface Size { - width: number; - height: number; - } - interface SizeOptions { /** * Normal size of the page. This can be used in combination with the attribute to @@ -4649,41 +7120,40 @@ declare namespace Electron { * An array of Strings that lists the types of desktop sources to be captured, * available types are and . */ - types: string[]; + types?: string[]; /** - * The suggested size that the media source thumbnail should be scaled to, defaults - * to . + * The size that the media source thumbnail should be scaled to. Default is x . */ - thumbnailSize?: ThumbnailSize; + thumbnailSize?: Size; } interface StartMonitoringOptions { - categoryFilter: string; - traceOptions: string; + categoryFilter?: string; + traceOptions?: string; } interface StartRecordingOptions { - categoryFilter: string; - traceOptions: string; + categoryFilter?: string; + traceOptions?: string; } interface SystemMemoryInfo { /** * The total amount of physical memory in Kilobytes available to the system. */ - total: number; + total?: number; /** * The total amount of memory not being used by applications or disk cache. */ - free: number; + free?: number; /** * The total amount of swap memory in Kilobytes available to the system. */ - swapTotal: number; + swapTotal?: number; /** * The free amount of swap memory in Kilobytes available to the system. */ - swapFree: number; + swapFree?: number; } interface ToBitmapOptions { @@ -4707,146 +7177,296 @@ declare namespace Electron { scaleFactor?: number; } - interface WorkAreaSize { - height: number; - width: number; + interface TouchBarButtonConstructorOptions { + /** + * Button text. + */ + label?: string; + /** + * Button background color in hex format, i.e . + */ + backgroundColor?: string; + /** + * Button icon. + */ + icon?: NativeImage; + /** + * Can be , or . + */ + iconPosition?: ('left' | 'right' | 'overlay'); + /** + * Function to call when the button is clicked. + */ + click?: () => void; + } + + interface TouchBarColorPickerConstructorOptions { + /** + * Array of hex color strings to appear as possible colors to select. + */ + availableColors?: string[]; + /** + * The selected hex color in the picker, i.e . + */ + selectedColor?: string; + /** + * Function to call when a color is selected. + */ + change?: (color?: string) => void; + } + + interface TouchBarGroupConstructorOptions { + /** + * Items to display as a group. + */ + items?: TouchBar; + } + + interface TouchBarLabelConstructorOptions { + /** + * Text to display. + */ + label?: string; + /** + * Hex color of text, i.e . + */ + textColor?: string; + } + + interface TouchBarPopoverConstructorOptions { + /** + * Popover button text. + */ + label?: string; + /** + * Popover button icon. + */ + icon?: NativeImage; + /** + * Items to display in the popover. + */ + items?: TouchBar; + /** + * to display a close button on the left of the popover, to not show it. Default is + * . + */ + showCloseButton?: boolean; + } + + interface TouchBarScrubberConstructorOptions { + /** + * An array of items to place in this scrubber + */ + items?: ScrubberItem[]; + /** + * Called when the user taps an item that was not the last tapped item + */ + select?: (selectedIndex?: number) => void; + /** + * Called when the user taps any item + */ + highlight?: (highlightedIndex?: number) => void; + /** + * Selected item style. Defaults to . + */ + selectedStyle?: string; + /** + * Selected overlay item style. Defaults to . + */ + overlayStyle?: string; + /** + * Defaults to . + */ + showArrowButtons?: boolean; + /** + * Defaults to . + */ + mode?: string; + /** + * Defaults to . + */ + continuous?: boolean; + } + + interface TouchBarSegmentedControlConstructorOptions { + /** + * Style of the segments: + */ + segmentStyle?: ('automatic' | 'rounded' | 'textured-rounded' | 'round-rect' | 'textured-square' | 'capsule' | 'small-square' | 'separated'); + /** + * The selection mode of the control: + */ + mode?: ('single' | 'multiple' | 'buttons'); + /** + * An array of segments to place in this control. + */ + segments?: SegmentedControlSegment[]; + /** + * The index of the currently selected segment, will update automatically with user + * interaction. When the mode is multiple it will be the last selected item. + */ + selectedIndex?: number; + /** + * Called when the user selects a new segment + */ + change?: (selectedIndex?: number, isSelected?: boolean) => void; + } + + interface TouchBarSliderConstructorOptions { + /** + * Label text. + */ + label?: string; + /** + * Selected value. + */ + value?: number; + /** + * Minimum value. + */ + minValue?: number; + /** + * Maximum value. + */ + maxValue?: number; + /** + * Function to call when the slider is changed. + */ + change?: (newValue?: number) => void; + } + + interface TouchBarSpacerConstructorOptions { + /** + * Size of spacer, possible values are: + */ + size?: ('small' | 'large' | 'flexible'); + } + + interface UpdateTargetUrlEvent extends Event { + url?: string; + } + + interface Versions { + /** + * A String representing Electron's version string. + */ + electron?: string; + /** + * A String representing Chrome's version string. + */ + chrome?: string; + } + + interface WillNavigateEvent extends Event { + url?: string; } interface EditFlags { /** * Whether the renderer believes it can undo. */ - canUndo: boolean; + canUndo?: boolean; /** * Whether the renderer believes it can redo. */ - canRedo: boolean; + canRedo?: boolean; /** * Whether the renderer believes it can cut. */ - canCut: boolean; + canCut?: boolean; /** * Whether the renderer believes it can copy */ - canCopy: boolean; + canCopy?: boolean; /** * Whether the renderer believes it can paste. */ - canPaste: boolean; + canPaste?: boolean; /** * Whether the renderer believes it can delete. */ - canDelete: boolean; + canDelete?: boolean; /** * Whether the renderer believes it can select all. */ - canSelectAll: boolean; + canSelectAll?: boolean; } interface Extra { } + interface FoundInPageResult { + requestId?: number; + /** + * Position of the active match. + */ + activeMatchOrdinal?: number; + /** + * Number of Matches. + */ + matches?: number; + /** + * Coordinates of first match region. + */ + selectionArea?: SelectionArea; + finalUpdate?: boolean; + } + + interface Headers { + } + interface MediaFlags { /** * Whether the media element has crashed. */ - inError: boolean; + inError?: boolean; /** * Whether the media element is paused. */ - isPaused: boolean; + isPaused?: boolean; /** * Whether the media element is muted. */ - isMuted: boolean; + isMuted?: boolean; /** * Whether the media element has audio. */ - hasAudio: boolean; + hasAudio?: boolean; /** * Whether the media element is looping. */ - isLooping: boolean; + isLooping?: boolean; /** * Whether the media element's controls are visible. */ - isControlsVisible: boolean; + isControlsVisible?: boolean; /** * Whether the media element's controls are toggleable. */ - canToggleControls: boolean; + canToggleControls?: boolean; /** * Whether the media element can be rotated. */ - canRotate: boolean; + canRotate?: boolean; } interface Normal { - width: number; - height: number; - } - - interface Offset { - /** - * Set the x axis offset from top left corner - */ - x: number; - /** - * Set the y axis offset from top left corner - */ - y: number; + width?: number; + height?: number; } interface Options { - /** - * The executable path to compare against. Defaults to . - */ - path?: string; - /** - * The command-line arguments to compare against. Defaults to an empty array. - */ - args?: string[]; } - interface ScreenSize { - /** - * Set the emulated screen width - */ - width: number; - /** - * Set the emulated screen height - */ - height: number; + interface RequestHeaders { + } + + interface ResponseHeaders { } interface SelectionArea { } - interface ThumbnailSize { - } - - interface ViewPosition { - /** - * Set the x axis offset from top left corner - */ - x: number; - /** - * Set the y axis offset from top left corner - */ - y: number; - } - - interface ViewSize { - /** - * Set the emulated view width - */ - width: number; - /** - * Set the emulated view height - */ - height: number; - } - interface WebPreferences { /** * Whether to enable DevTools. If it is set to , can not use to open DevTools. @@ -4870,6 +7490,14 @@ declare namespace Electron { * reintroduce Node global symbols back to the global scope. See example . */ preload?: string; + /** + * If set, this will sandbox the renderer associated with the window, making it + * compatible with the Chromium OS-level sandbox and disabling the Node.js engine. + * This is not the same as the option and the APIs available to the preload script + * are more limited. Read more about the option . This option is currently + * experimental and may change or be removed in future Electron releases. + */ + sandbox?: boolean; /** * Sets the session used by the page. Instead of passing the Session object * directly, you can also choose to use the option instead, which accepts a @@ -4975,10 +7603,6 @@ declare namespace Electron { * the for more details. */ offscreen?: boolean; - /** - * Whether to enable Chromium OS-level sandbox. - */ - sandbox?: boolean; /** * Whether to run Electron APIs and the specified script in a separate JavaScript * context. Defaults to . The context that the script runs in will still have full @@ -5035,7 +7659,7 @@ interface NodeRequireFunction { } interface File { - /** + /** * The real path to the file on the users filesystem */ path: string; @@ -5043,7 +7667,85 @@ interface File { declare module 'original-fs' { import * as fs from 'fs'; - export = fs; } +interface Document { + createElement(tagName: 'webview'): Electron.WebviewTag; +} + +declare namespace NodeJS { + interface Process extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/process + + /** + * Emitted when Electron has loaded its internal initialization script and is + * beginning to load the web page or the main script. It can be used by the preload + * script to add removed Node global symbols back to the global scope when node + * integration is turned off: + */ + on(event: 'loaded', listener: Function): this; + once(event: 'loaded', listener: Function): this; + addListener(event: 'loaded', listener: Function): this; + removeListener(event: 'loaded', listener: Function): this; + /** + * Causes the main thread of the current process crash. + */ + crash(): void; + getCPUUsage(CPUUsage: CPUUsage): void; + getIOCounters(IOCounters: IOCounters): void; + /** + * Returns an object giving memory usage statistics about the current process. Note + * that all statistics are reported in Kilobytes. + */ + getProcessMemoryInfo(): Electron.ProcessMemoryInfo; + /** + * Returns an object giving memory usage statistics about the entire system. Note + * that all statistics are reported in Kilobytes. + */ + getSystemMemoryInfo(): Electron.SystemMemoryInfo; + /** + * Causes the main thread of the current process hang. + */ + hang(): void; + /** + * Sets the file descriptor soft limit to maxDescriptors or the OS hard limit, + * whichever is lower for the current process. + */ + setFdLimit(maxDescriptors: number): void; + /** + * A Boolean. When app is started by being passed as parameter to the default app, + * this property is true in the main process, otherwise it is undefined. + */ + defaultApp?: boolean; + /** + * A Boolean. For Mac App Store build, this property is true, for other builds it + * is undefined. + */ + mas?: boolean; + /** + * A Boolean that controls ASAR support inside your application. Setting this to + * true will disable the support for asar archives in Node's built-in modules. + */ + noAsar?: boolean; + /** + * A String representing the path to the resources directory. + */ + resourcesPath?: string; + /** + * A String representing the current process's type, can be "browser" (i.e. main + * process) or "renderer". + */ + type?: string; + /** + * A Boolean. If the app is running as a Windows Store app (appx), this property is + * true, for otherwise it is undefined. + */ + windowsStore?: boolean; + } + interface ProcessVersions { + electron: string; + chrome: string; + } +} From 8dde4075e41f15461613f07e8c2f5f4732e34ac5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 10 May 2017 09:25:04 -0700 Subject: [PATCH 310/328] Update electron.d.ts for 1.6.9 --- npm/electron.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/electron.d.ts b/npm/electron.d.ts index dc2404437194..a8e7bbb05ae7 100644 --- a/npm/electron.d.ts +++ b/npm/electron.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Electron 1.6.8 +// Type definitions for Electron 1.6.9 // Project: http://electron.atom.io/ // Definitions by: The Electron Team // Definitions: https://github.com/electron/electron-typescript-definitions @@ -2333,7 +2333,7 @@ declare namespace Electron { * Note: The following methods are useful specifically to resume a cancelled item * when session is restarted. */ - getState(): string; + getState(): ('progressing' | 'completed' | 'cancelled' | 'interrupted'); /** * If the size is unknown, it returns 0. */ From 584cffe7c8bb872c85b549187f633011a2c5c898 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Wed, 10 May 2017 09:39:34 -0700 Subject: [PATCH 311/328] Update to Electron v1.6.9 --- npm/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/package.json b/npm/package.json index a4aff3358026..ca58a605e4c4 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.6.8", + "version": "1.6.9", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { @@ -32,4 +32,4 @@ "keywords": [ "electron" ] -} +} \ No newline at end of file From 9d8b9ece5cf6ff79f03166f736cbb1b121b0e7da Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 10 May 2017 12:52:00 -0700 Subject: [PATCH 312/328] Update to electron.d.ts@1.7.0 --- npm/electron.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/electron.d.ts b/npm/electron.d.ts index a8e7bbb05ae7..f0e328661078 100644 --- a/npm/electron.d.ts +++ b/npm/electron.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Electron 1.6.9 +// Type definitions for Electron 1.7.0 // Project: http://electron.atom.io/ // Definitions by: The Electron Team // Definitions: https://github.com/electron/electron-typescript-definitions From 18615da0756e8ba8fee604b1fbd8c04bee327161 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Wed, 10 May 2017 12:58:24 -0700 Subject: [PATCH 313/328] Update to Electron v1.7.0 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index ca58a605e4c4..47e0f0a25bce 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.6.9", + "version": "1.7.0", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From b6a05a684f83933fcbb6934fada48c0c79e882a0 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Wed, 10 May 2017 23:38:51 -0700 Subject: [PATCH 314/328] add @types/node --- npm/package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/npm/package.json b/npm/package.json index 47e0f0a25bce..76a33fee1c72 100644 --- a/npm/package.json +++ b/npm/package.json @@ -15,8 +15,9 @@ "main": "index.js", "types": "electron.d.ts", "dependencies": { - "extract-zip": "^1.0.3", - "electron-download": "^3.0.1" + "@types/node": "^7.0.18", + "electron-download": "^3.0.1", + "extract-zip": "^1.0.3" }, "devDependencies": { "home-path": "^0.1.1", @@ -32,4 +33,4 @@ "keywords": [ "electron" ] -} \ No newline at end of file +} From a12d7356d9e36b063d7ec093f2ea8d17d665bfef Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 16 May 2017 12:33:38 -0700 Subject: [PATCH 315/328] Update to electron.d.ts@1.6.10 --- npm/electron.d.ts | 2884 +++++++++++++++++++++++---------------------- 1 file changed, 1457 insertions(+), 1427 deletions(-) diff --git a/npm/electron.d.ts b/npm/electron.d.ts index f0e328661078..fc32d23f4878 100644 --- a/npm/electron.d.ts +++ b/npm/electron.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Electron 1.7.0 +// Type definitions for Electron 1.6.10 // Project: http://electron.atom.io/ // Definitions by: The Electron Team // Definitions: https://github.com/electron/electron-typescript-definitions @@ -131,40 +131,40 @@ declare namespace Electron { * https://www.chromium.org/developers/design-documents/accessibility for more * details. */ - on(event: 'accessibility-support-changed', listener: (event?: Event, + on(event: 'accessibility-support-changed', listener: (event: Event, /** * `true` when Chrome's accessibility support is enabled, `false` otherwise. */ - accessibilitySupportEnabled?: boolean) => void): this; - once(event: 'accessibility-support-changed', listener: (event?: Event, + accessibilitySupportEnabled: boolean) => void): this; + once(event: 'accessibility-support-changed', listener: (event: Event, /** * `true` when Chrome's accessibility support is enabled, `false` otherwise. */ - accessibilitySupportEnabled?: boolean) => void): this; - addListener(event: 'accessibility-support-changed', listener: (event?: Event, + accessibilitySupportEnabled: boolean) => void): this; + addListener(event: 'accessibility-support-changed', listener: (event: Event, /** * `true` when Chrome's accessibility support is enabled, `false` otherwise. */ - accessibilitySupportEnabled?: boolean) => void): this; - removeListener(event: 'accessibility-support-changed', listener: (event?: Event, + accessibilitySupportEnabled: boolean) => void): this; + removeListener(event: 'accessibility-support-changed', listener: (event: Event, /** * `true` when Chrome's accessibility support is enabled, `false` otherwise. */ - accessibilitySupportEnabled?: boolean) => void): this; + accessibilitySupportEnabled: boolean) => void): this; /** * Emitted when the application is activated. Various actions can trigger this * event, such as launching the application for the first time, attempting to * re-launch the application when it's already running, or clicking on the * application's dock or taskbar icon. */ - on(event: 'activate', listener: (event?: Event, - hasVisibleWindows?: boolean) => void): this; - once(event: 'activate', listener: (event?: Event, - hasVisibleWindows?: boolean) => void): this; - addListener(event: 'activate', listener: (event?: Event, - hasVisibleWindows?: boolean) => void): this; - removeListener(event: 'activate', listener: (event?: Event, - hasVisibleWindows?: boolean) => void): this; + on(event: 'activate', listener: (event: Event, + hasVisibleWindows: boolean) => void): this; + once(event: 'activate', listener: (event: Event, + hasVisibleWindows: boolean) => void): this; + addListener(event: 'activate', listener: (event: Event, + hasVisibleWindows: boolean) => void): this; + removeListener(event: 'activate', listener: (event: Event, + hasVisibleWindows: boolean) => void): this; /** * Emitted before the application starts closing its windows. Calling * event.preventDefault() will prevent the default behaviour, which is terminating @@ -172,84 +172,84 @@ declare namespace Electron { * autoUpdater.quitAndInstall() then before-quit is emitted after emitting close * event on all windows and closing them. */ - on(event: 'before-quit', listener: (event?: Event) => void): this; - once(event: 'before-quit', listener: (event?: Event) => void): this; - addListener(event: 'before-quit', listener: (event?: Event) => void): this; - removeListener(event: 'before-quit', listener: (event?: Event) => void): this; + on(event: 'before-quit', listener: (event: Event) => void): this; + once(event: 'before-quit', listener: (event: Event) => void): this; + addListener(event: 'before-quit', listener: (event: Event) => void): this; + removeListener(event: 'before-quit', listener: (event: Event) => void): this; /** * Emitted when a browserWindow gets blurred. */ - on(event: 'browser-window-blur', listener: (event?: Event, - window?: BrowserWindow) => void): this; - once(event: 'browser-window-blur', listener: (event?: Event, - window?: BrowserWindow) => void): this; - addListener(event: 'browser-window-blur', listener: (event?: Event, - window?: BrowserWindow) => void): this; - removeListener(event: 'browser-window-blur', listener: (event?: Event, - window?: BrowserWindow) => void): this; + on(event: 'browser-window-blur', listener: (event: Event, + window: BrowserWindow) => void): this; + once(event: 'browser-window-blur', listener: (event: Event, + window: BrowserWindow) => void): this; + addListener(event: 'browser-window-blur', listener: (event: Event, + window: BrowserWindow) => void): this; + removeListener(event: 'browser-window-blur', listener: (event: Event, + window: BrowserWindow) => void): this; /** * Emitted when a new browserWindow is created. */ - on(event: 'browser-window-created', listener: (event?: Event, - window?: BrowserWindow) => void): this; - once(event: 'browser-window-created', listener: (event?: Event, - window?: BrowserWindow) => void): this; - addListener(event: 'browser-window-created', listener: (event?: Event, - window?: BrowserWindow) => void): this; - removeListener(event: 'browser-window-created', listener: (event?: Event, - window?: BrowserWindow) => void): this; + on(event: 'browser-window-created', listener: (event: Event, + window: BrowserWindow) => void): this; + once(event: 'browser-window-created', listener: (event: Event, + window: BrowserWindow) => void): this; + addListener(event: 'browser-window-created', listener: (event: Event, + window: BrowserWindow) => void): this; + removeListener(event: 'browser-window-created', listener: (event: Event, + window: BrowserWindow) => void): this; /** * Emitted when a browserWindow gets focused. */ - on(event: 'browser-window-focus', listener: (event?: Event, - window?: BrowserWindow) => void): this; - once(event: 'browser-window-focus', listener: (event?: Event, - window?: BrowserWindow) => void): this; - addListener(event: 'browser-window-focus', listener: (event?: Event, - window?: BrowserWindow) => void): this; - removeListener(event: 'browser-window-focus', listener: (event?: Event, - window?: BrowserWindow) => void): this; + on(event: 'browser-window-focus', listener: (event: Event, + window: BrowserWindow) => void): this; + once(event: 'browser-window-focus', listener: (event: Event, + window: BrowserWindow) => void): this; + addListener(event: 'browser-window-focus', listener: (event: Event, + window: BrowserWindow) => void): this; + removeListener(event: 'browser-window-focus', listener: (event: Event, + window: BrowserWindow) => void): this; /** * Emitted when failed to verify the certificate for url, to trust the certificate * you should prevent the default behavior with event.preventDefault() and call * callback(true). */ - on(event: 'certificate-error', listener: (event?: Event, - webContents?: WebContents, - url?: string, + on(event: 'certificate-error', listener: (event: Event, + webContents: WebContents, + url: string, /** * The error code */ - error?: string, - certificate?: Certificate, - callback?: (isTrusted?: boolean) => void) => void): this; - once(event: 'certificate-error', listener: (event?: Event, - webContents?: WebContents, - url?: string, + error: string, + certificate: Certificate, + callback: (isTrusted: boolean) => void) => void): this; + once(event: 'certificate-error', listener: (event: Event, + webContents: WebContents, + url: string, /** * The error code */ - error?: string, - certificate?: Certificate, - callback?: (isTrusted?: boolean) => void) => void): this; - addListener(event: 'certificate-error', listener: (event?: Event, - webContents?: WebContents, - url?: string, + error: string, + certificate: Certificate, + callback: (isTrusted: boolean) => void) => void): this; + addListener(event: 'certificate-error', listener: (event: Event, + webContents: WebContents, + url: string, /** * The error code */ - error?: string, - certificate?: Certificate, - callback?: (isTrusted?: boolean) => void) => void): this; - removeListener(event: 'certificate-error', listener: (event?: Event, - webContents?: WebContents, - url?: string, + error: string, + certificate: Certificate, + callback: (isTrusted: boolean) => void) => void): this; + removeListener(event: 'certificate-error', listener: (event: Event, + webContents: WebContents, + url: string, /** * The error code */ - error?: string, - certificate?: Certificate, - callback?: (isTrusted?: boolean) => void) => void): this; + error: string, + certificate: Certificate, + callback: (isTrusted: boolean) => void) => void): this; /** * Emitted during Handoff when an activity from a different device wants to be * resumed. You should call event.preventDefault() if you want to handle this @@ -258,79 +258,79 @@ declare namespace Electron { * type. Supported activity types are specified in the app's Info.plist under the * NSUserActivityTypes key. */ - on(event: 'continue-activity', listener: (event?: Event, + on(event: 'continue-activity', listener: (event: Event, /** * A string identifying the activity. Maps to . */ - type?: string, + type: string, /** * Contains app-specific state stored by the activity on another device. */ - userInfo?: any) => void): this; - once(event: 'continue-activity', listener: (event?: Event, + userInfo: any) => void): this; + once(event: 'continue-activity', listener: (event: Event, /** * A string identifying the activity. Maps to . */ - type?: string, + type: string, /** * Contains app-specific state stored by the activity on another device. */ - userInfo?: any) => void): this; - addListener(event: 'continue-activity', listener: (event?: Event, + userInfo: any) => void): this; + addListener(event: 'continue-activity', listener: (event: Event, /** * A string identifying the activity. Maps to . */ - type?: string, + type: string, /** * Contains app-specific state stored by the activity on another device. */ - userInfo?: any) => void): this; - removeListener(event: 'continue-activity', listener: (event?: Event, + userInfo: any) => void): this; + removeListener(event: 'continue-activity', listener: (event: Event, /** * A string identifying the activity. Maps to . */ - type?: string, + type: string, /** * Contains app-specific state stored by the activity on another device. */ - userInfo?: any) => void): this; + userInfo: any) => void): this; /** * Emitted when the gpu process crashes or is killed. */ - on(event: 'gpu-process-crashed', listener: (event?: Event, - killed?: boolean) => void): this; - once(event: 'gpu-process-crashed', listener: (event?: Event, - killed?: boolean) => void): this; - addListener(event: 'gpu-process-crashed', listener: (event?: Event, - killed?: boolean) => void): this; - removeListener(event: 'gpu-process-crashed', listener: (event?: Event, - killed?: boolean) => void): this; + on(event: 'gpu-process-crashed', listener: (event: Event, + killed: boolean) => void): this; + once(event: 'gpu-process-crashed', listener: (event: Event, + killed: boolean) => void): this; + addListener(event: 'gpu-process-crashed', listener: (event: Event, + killed: boolean) => void): this; + removeListener(event: 'gpu-process-crashed', listener: (event: Event, + killed: boolean) => void): this; /** * Emitted when webContents wants to do basic auth. The default behavior is to * cancel all authentications, to override this you should prevent the default * behavior with event.preventDefault() and call callback(username, password) with * the credentials. */ - on(event: 'login', listener: (event?: Event, - webContents?: WebContents, - request?: Request, - authInfo?: AuthInfo, - callback?: (username?: string, password?: string) => void) => void): this; - once(event: 'login', listener: (event?: Event, - webContents?: WebContents, - request?: Request, - authInfo?: AuthInfo, - callback?: (username?: string, password?: string) => void) => void): this; - addListener(event: 'login', listener: (event?: Event, - webContents?: WebContents, - request?: Request, - authInfo?: AuthInfo, - callback?: (username?: string, password?: string) => void) => void): this; - removeListener(event: 'login', listener: (event?: Event, - webContents?: WebContents, - request?: Request, - authInfo?: AuthInfo, - callback?: (username?: string, password?: string) => void) => void): this; + on(event: 'login', listener: (event: Event, + webContents: WebContents, + request: Request, + authInfo: AuthInfo, + callback: (username: string, password: string) => void) => void): this; + once(event: 'login', listener: (event: Event, + webContents: WebContents, + request: Request, + authInfo: AuthInfo, + callback: (username: string, password: string) => void) => void): this; + addListener(event: 'login', listener: (event: Event, + webContents: WebContents, + request: Request, + authInfo: AuthInfo, + callback: (username: string, password: string) => void) => void): this; + removeListener(event: 'login', listener: (event: Event, + webContents: WebContents, + request: Request, + authInfo: AuthInfo, + callback: (username: string, password: string) => void) => void): this; /** * Emitted when the user wants to open a file with the application. The open-file * event is usually emitted when the application is already open and the OS wants @@ -341,86 +341,86 @@ declare namespace Electron { * event.preventDefault() if you want to handle this event. On Windows, you have to * parse process.argv (in the main process) to get the filepath. */ - on(event: 'open-file', listener: (event?: Event, - path?: string) => void): this; - once(event: 'open-file', listener: (event?: Event, - path?: string) => void): this; - addListener(event: 'open-file', listener: (event?: Event, - path?: string) => void): this; - removeListener(event: 'open-file', listener: (event?: Event, - path?: string) => void): this; + on(event: 'open-file', listener: (event: Event, + path: string) => void): this; + once(event: 'open-file', listener: (event: Event, + path: string) => void): this; + addListener(event: 'open-file', listener: (event: Event, + path: string) => void): this; + removeListener(event: 'open-file', listener: (event: Event, + path: string) => void): this; /** * Emitted when the user wants to open a URL with the application. Your * application's Info.plist file must define the url scheme within the * CFBundleURLTypes key, and set NSPrincipalClass to AtomApplication. You should * call event.preventDefault() if you want to handle this event. */ - on(event: 'open-url', listener: (event?: Event, - url?: string) => void): this; - once(event: 'open-url', listener: (event?: Event, - url?: string) => void): this; - addListener(event: 'open-url', listener: (event?: Event, - url?: string) => void): this; - removeListener(event: 'open-url', listener: (event?: Event, - url?: string) => void): this; + on(event: 'open-url', listener: (event: Event, + url: string) => void): this; + once(event: 'open-url', listener: (event: Event, + url: string) => void): this; + addListener(event: 'open-url', listener: (event: Event, + url: string) => void): this; + removeListener(event: 'open-url', listener: (event: Event, + url: string) => void): this; /** * Emitted when the application is quitting. */ - on(event: 'quit', listener: (event?: Event, - exitCode?: number) => void): this; - once(event: 'quit', listener: (event?: Event, - exitCode?: number) => void): this; - addListener(event: 'quit', listener: (event?: Event, - exitCode?: number) => void): this; - removeListener(event: 'quit', listener: (event?: Event, - exitCode?: number) => void): this; + on(event: 'quit', listener: (event: Event, + exitCode: number) => void): this; + once(event: 'quit', listener: (event: Event, + exitCode: number) => void): this; + addListener(event: 'quit', listener: (event: Event, + exitCode: number) => void): this; + removeListener(event: 'quit', listener: (event: Event, + exitCode: number) => void): this; /** * Emitted when Electron has finished initializing. On macOS, launchInfo holds the * userInfo of the NSUserNotification that was used to open the application, if it * was launched from Notification Center. You can call app.isReady() to check if * this event has already fired. */ - on(event: 'ready', listener: (launchInfo?: any) => void): this; - once(event: 'ready', listener: (launchInfo?: any) => void): this; - addListener(event: 'ready', listener: (launchInfo?: any) => void): this; - removeListener(event: 'ready', listener: (launchInfo?: any) => void): this; + on(event: 'ready', listener: (launchInfo: any) => void): this; + once(event: 'ready', listener: (launchInfo: any) => void): this; + addListener(event: 'ready', listener: (launchInfo: any) => void): this; + removeListener(event: 'ready', listener: (launchInfo: any) => void): this; /** * Emitted when a client certificate is requested. The url corresponds to the * navigation entry requesting the client certificate and callback can be called * with an entry filtered from the list. Using event.preventDefault() prevents the * application from using the first certificate from the store. */ - on(event: 'select-client-certificate', listener: (event?: Event, - webContents?: WebContents, - url?: string, - certificateList?: Certificate[], - callback?: (certificate?: Certificate) => void) => void): this; - once(event: 'select-client-certificate', listener: (event?: Event, - webContents?: WebContents, - url?: string, - certificateList?: Certificate[], - callback?: (certificate?: Certificate) => void) => void): this; - addListener(event: 'select-client-certificate', listener: (event?: Event, - webContents?: WebContents, - url?: string, - certificateList?: Certificate[], - callback?: (certificate?: Certificate) => void) => void): this; - removeListener(event: 'select-client-certificate', listener: (event?: Event, - webContents?: WebContents, - url?: string, - certificateList?: Certificate[], - callback?: (certificate?: Certificate) => void) => void): this; + on(event: 'select-client-certificate', listener: (event: Event, + webContents: WebContents, + url: string, + certificateList: Certificate[], + callback: (certificate?: Certificate) => void) => void): this; + once(event: 'select-client-certificate', listener: (event: Event, + webContents: WebContents, + url: string, + certificateList: Certificate[], + callback: (certificate?: Certificate) => void) => void): this; + addListener(event: 'select-client-certificate', listener: (event: Event, + webContents: WebContents, + url: string, + certificateList: Certificate[], + callback: (certificate?: Certificate) => void) => void): this; + removeListener(event: 'select-client-certificate', listener: (event: Event, + webContents: WebContents, + url: string, + certificateList: Certificate[], + callback: (certificate?: Certificate) => void) => void): this; /** * Emitted when a new webContents is created. */ - on(event: 'web-contents-created', listener: (event?: Event, - webContents?: WebContents) => void): this; - once(event: 'web-contents-created', listener: (event?: Event, - webContents?: WebContents) => void): this; - addListener(event: 'web-contents-created', listener: (event?: Event, - webContents?: WebContents) => void): this; - removeListener(event: 'web-contents-created', listener: (event?: Event, - webContents?: WebContents) => void): this; + on(event: 'web-contents-created', listener: (event: Event, + webContents: WebContents) => void): this; + once(event: 'web-contents-created', listener: (event: Event, + webContents: WebContents) => void): this; + addListener(event: 'web-contents-created', listener: (event: Event, + webContents: WebContents) => void): this; + removeListener(event: 'web-contents-created', listener: (event: Event, + webContents: WebContents) => void): this; /** * Emitted when the application has finished basic startup. On Windows and Linux, * the will-finish-launching event is the same as the ready event; on macOS, this @@ -439,10 +439,10 @@ declare namespace Electron { * the application. See the description of the window-all-closed event for the * differences between the will-quit and window-all-closed events. */ - on(event: 'will-quit', listener: (event?: Event) => void): this; - once(event: 'will-quit', listener: (event?: Event) => void): this; - addListener(event: 'will-quit', listener: (event?: Event) => void): this; - removeListener(event: 'will-quit', listener: (event?: Event) => void): this; + on(event: 'will-quit', listener: (event: Event) => void): this; + once(event: 'will-quit', listener: (event: Event) => void): this; + addListener(event: 'will-quit', listener: (event: Event) => void): this; + removeListener(event: 'will-quit', listener: (event: Event) => void): this; /** * Emitted when all windows have been closed. If you do not subscribe to this event * and all windows are closed, the default behavior is to quit the app; however, if @@ -493,12 +493,12 @@ declare namespace Electron { * Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux * and macOS, icons depend on the application associated with file mime type. */ - getFileIcon(path: string, options: FileIconOptions, callback: (error?: Error, icon?: NativeImage) => void): void; + getFileIcon(path: string, options: FileIconOptions, callback: (error: Error, icon: NativeImage) => void): void; /** * Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux * and macOS, icons depend on the application associated with file mime type. */ - getFileIcon(path: string, callback: (error?: Error, icon?: NativeImage) => void): void; + getFileIcon(path: string, callback: (error: Error, icon: NativeImage) => void): void; getJumpListSettings(): JumpListSettings; /** * Note: When distributing your packaged app, you have to also ship the locales @@ -534,7 +534,7 @@ declare namespace Electron { * success while any other value indicates failure according to chromium * net_error_list. */ - importCertificate(options: ImportCertificateOptions, callback: (result?: number) => void): void; + importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void; isAccessibilitySupportEnabled(): boolean; /** * This method checks if the current executable is the default handler for a @@ -567,7 +567,7 @@ declare namespace Electron { * and you have to use this method to ensure single instance. An example of * activating the window of primary instance when a second instance starts: */ - makeSingleInstance(callback: (argv?: string[], workingDirectory?: string) => void): void; + makeSingleInstance(callback: (argv: string[], workingDirectory: string) => void): boolean; /** * Try to close all windows. The before-quit event will be emitted first. If all * windows are successfully closed, the will-quit event will be emitted and by @@ -684,8 +684,8 @@ declare namespace Electron { * them. */ show(): void; - commandLine?: CommandLine; - dock?: Dock; + commandLine: CommandLine; + dock: Dock; } interface AutoUpdater extends EventEmitter { @@ -702,10 +702,10 @@ declare namespace Electron { /** * Emitted when there is an error while updating. */ - on(event: 'error', listener: (error?: Error) => void): this; - once(event: 'error', listener: (error?: Error) => void): this; - addListener(event: 'error', listener: (error?: Error) => void): this; - removeListener(event: 'error', listener: (error?: Error) => void): this; + on(event: 'error', listener: (error: Error) => void): this; + once(event: 'error', listener: (error: Error) => void): this; + addListener(event: 'error', listener: (error: Error) => void): this; + removeListener(event: 'error', listener: (error: Error) => void): this; /** * Emitted when there is an available update. The update is downloaded * automatically. @@ -718,26 +718,26 @@ declare namespace Electron { * Emitted when an update has been downloaded. On Windows only releaseName is * available. */ - on(event: 'update-downloaded', listener: (event?: Event, - releaseNotes?: string, - releaseName?: string, - releaseDate?: Date, - updateURL?: string) => void): this; - once(event: 'update-downloaded', listener: (event?: Event, - releaseNotes?: string, - releaseName?: string, - releaseDate?: Date, - updateURL?: string) => void): this; - addListener(event: 'update-downloaded', listener: (event?: Event, - releaseNotes?: string, - releaseName?: string, - releaseDate?: Date, - updateURL?: string) => void): this; - removeListener(event: 'update-downloaded', listener: (event?: Event, - releaseNotes?: string, - releaseName?: string, - releaseDate?: Date, - updateURL?: string) => void): this; + on(event: 'update-downloaded', listener: (event: Event, + releaseNotes: string, + releaseName: string, + releaseDate: Date, + updateURL: string) => void): this; + once(event: 'update-downloaded', listener: (event: Event, + releaseNotes: string, + releaseName: string, + releaseDate: Date, + updateURL: string) => void): this; + addListener(event: 'update-downloaded', listener: (event: Event, + releaseNotes: string, + releaseName: string, + releaseDate: Date, + updateURL: string) => void): this; + removeListener(event: 'update-downloaded', listener: (event: Event, + releaseNotes: string, + releaseName: string, + releaseDate: Date, + updateURL: string) => void): this; /** * Emitted when there is no available update. */ @@ -769,8 +769,8 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/structures/bluetooth-device - deviceId?: string; - deviceName?: string; + deviceId: string; + deviceName: string; } class BrowserView extends EventEmitter { @@ -779,13 +779,13 @@ declare namespace Electron { constructor(options?: BrowserViewConstructorOptions); setAutoResize(options: AutoResizeOptions): void; - setBackgroundColor(color?: string): void; + setBackgroundColor(color: string): void; /** * Resizes and moves the view to the supplied bounds relative to the window. */ setBounds(bounds: Rectangle): void; id: number; - webContents: webContents; + webContents: WebContents; } class BrowserWindow extends EventEmitter { @@ -799,14 +799,14 @@ declare namespace Electron { * and the APPCOMMAND_ prefix is stripped off. e.g. APPCOMMAND_BROWSER_BACKWARD is * emitted as browser-backward. */ - on(event: 'app-command', listener: (event?: Event, - command?: string) => void): this; - once(event: 'app-command', listener: (event?: Event, - command?: string) => void): this; - addListener(event: 'app-command', listener: (event?: Event, - command?: string) => void): this; - removeListener(event: 'app-command', listener: (event?: Event, - command?: string) => void): this; + on(event: 'app-command', listener: (event: Event, + command: string) => void): this; + once(event: 'app-command', listener: (event: Event, + command: string) => void): this; + addListener(event: 'app-command', listener: (event: Event, + command: string) => void): this; + removeListener(event: 'app-command', listener: (event: Event, + command: string) => void): this; /** * Emitted when the window loses focus. */ @@ -822,10 +822,10 @@ declare namespace Electron { * window is reloaded. In Electron, returning any value other than undefined would * cancel the close. For example: */ - on(event: 'close', listener: (event?: Event) => void): this; - once(event: 'close', listener: (event?: Event) => void): this; - addListener(event: 'close', listener: (event?: Event) => void): this; - removeListener(event: 'close', listener: (event?: Event) => void): this; + on(event: 'close', listener: (event: Event) => void): this; + once(event: 'close', listener: (event: Event) => void): this; + addListener(event: 'close', listener: (event: Event) => void): this; + removeListener(event: 'close', listener: (event: Event) => void): this; /** * Emitted when the window is closed. After you have received this event you should * remove the reference to the window and avoid using it any more. @@ -909,14 +909,14 @@ declare namespace Electron { * Emitted when the document changed its title, calling event.preventDefault() will * prevent the native window's title from changing. */ - on(event: 'page-title-updated', listener: (event?: Event, - title?: string) => void): this; - once(event: 'page-title-updated', listener: (event?: Event, - title?: string) => void): this; - addListener(event: 'page-title-updated', listener: (event?: Event, - title?: string) => void): this; - removeListener(event: 'page-title-updated', listener: (event?: Event, - title?: string) => void): this; + on(event: 'page-title-updated', listener: (event: Event, + title: string) => void): this; + once(event: 'page-title-updated', listener: (event: Event, + title: string) => void): this; + addListener(event: 'page-title-updated', listener: (event: Event, + title: string) => void): this; + removeListener(event: 'page-title-updated', listener: (event: Event, + title: string) => void): this; /** * Emitted when the web page has been rendered (while not being shown) and window * can be displayed without a visual flash. @@ -999,14 +999,14 @@ declare namespace Electron { /** * Emitted on 3-finger swipe. Possible directions are up, right, down, left. */ - on(event: 'swipe', listener: (event?: Event, - direction?: string) => void): this; - once(event: 'swipe', listener: (event?: Event, - direction?: string) => void): this; - addListener(event: 'swipe', listener: (event?: Event, - direction?: string) => void): this; - removeListener(event: 'swipe', listener: (event?: Event, - direction?: string) => void): this; + on(event: 'swipe', listener: (event: Event, + direction: string) => void): this; + once(event: 'swipe', listener: (event: Event, + direction: string) => void): this; + addListener(event: 'swipe', listener: (event: Event, + direction: string) => void): this; + removeListener(event: 'swipe', listener: (event: Event, + direction: string) => void): this; /** * Emitted when the window exits from a maximized state. */ @@ -1054,11 +1054,11 @@ declare namespace Electron { /** * Same as webContents.capturePage([rect, ]callback). */ - capturePage(callback: (image?: NativeImage) => void): void; + capturePage(callback: (image: NativeImage) => void): void; /** * Same as webContents.capturePage([rect, ]callback). */ - capturePage(rect: Rectangle, callback: (image?: NativeImage) => void): void; + capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; /** * Moves window to the center of the screen. */ @@ -1478,43 +1478,43 @@ declare namespace Electron { /** * PEM encoded data */ - data?: string; + data: string; /** * Fingerprint of the certificate */ - fingerprint?: string; + fingerprint: string; /** * Issuer principal */ - issuer?: CertificatePrincipal; + issuer: CertificatePrincipal; /** * Issuer certificate (if not self-signed) */ - issuerCert?: Certificate; + issuerCert: Certificate; /** * Issuer's Common Name */ - issuerName?: string; + issuerName: string; /** * Hex value represented string */ - serialNumber?: string; + serialNumber: string; /** * Subject principal */ - subject?: CertificatePrincipal; + subject: CertificatePrincipal; /** * Subject's Common Name */ - subjectName?: string; + subjectName: string; /** * End date of the certificate being valid in seconds */ - validExpiry?: number; + validExpiry: number; /** * Start date of the certificate being valid in seconds */ - validStart?: number; + validStart: number; } interface CertificatePrincipal { @@ -1524,27 +1524,27 @@ declare namespace Electron { /** * Common Name */ - commonName?: string; + commonName: string; /** * Country or region */ - country?: string; + country: string; /** * Locality */ - locality?: string; + locality: string; /** * Organization names */ - organizations?: string[]; + organizations: string[]; /** * Organization Unit names */ - organizationUnits?: string[]; + organizationUnits: string[]; /** * State or province */ - state?: string; + state: string; } class ClientRequest extends EventEmitter { @@ -1577,22 +1577,22 @@ declare namespace Electron { /** * an error object providing some information about the failure. */ - error?: Error) => void): this; + error: Error) => void): this; once(event: 'error', listener: ( /** * an error object providing some information about the failure. */ - error?: Error) => void): this; + error: Error) => void): this; addListener(event: 'error', listener: ( /** * an error object providing some information about the failure. */ - error?: Error) => void): this; + error: Error) => void): this; removeListener(event: 'error', listener: ( /** * an error object providing some information about the failure. */ - error?: Error) => void): this; + error: Error) => void): this; /** * Emitted just after the last chunk of the request's data has been written into * the request object. @@ -1607,54 +1607,54 @@ declare namespace Electron { * empty credentials will cancel the request and report an authentication error on * the response object: */ - on(event: 'login', listener: (authInfo?: AuthInfo, - callback?: (username?: string, password?: string) => void) => void): this; - once(event: 'login', listener: (authInfo?: AuthInfo, - callback?: (username?: string, password?: string) => void) => void): this; - addListener(event: 'login', listener: (authInfo?: AuthInfo, - callback?: (username?: string, password?: string) => void) => void): this; - removeListener(event: 'login', listener: (authInfo?: AuthInfo, - callback?: (username?: string, password?: string) => void) => void): this; + on(event: 'login', listener: (authInfo: AuthInfo, + callback: (username: string, password: string) => void) => void): this; + once(event: 'login', listener: (authInfo: AuthInfo, + callback: (username: string, password: string) => void) => void): this; + addListener(event: 'login', listener: (authInfo: AuthInfo, + callback: (username: string, password: string) => void) => void): this; + removeListener(event: 'login', listener: (authInfo: AuthInfo, + callback: (username: string, password: string) => void) => void): this; /** * Emitted when there is redirection and the mode is manual. Calling * request.followRedirect will continue with the redirection. */ - on(event: 'redirect', listener: (statusCode?: number, - method?: string, - redirectUrl?: string, - responseHeaders?: any) => void): this; - once(event: 'redirect', listener: (statusCode?: number, - method?: string, - redirectUrl?: string, - responseHeaders?: any) => void): this; - addListener(event: 'redirect', listener: (statusCode?: number, - method?: string, - redirectUrl?: string, - responseHeaders?: any) => void): this; - removeListener(event: 'redirect', listener: (statusCode?: number, - method?: string, - redirectUrl?: string, - responseHeaders?: any) => void): this; + on(event: 'redirect', listener: (statusCode: number, + method: string, + redirectUrl: string, + responseHeaders: any) => void): this; + once(event: 'redirect', listener: (statusCode: number, + method: string, + redirectUrl: string, + responseHeaders: any) => void): this; + addListener(event: 'redirect', listener: (statusCode: number, + method: string, + redirectUrl: string, + responseHeaders: any) => void): this; + removeListener(event: 'redirect', listener: (statusCode: number, + method: string, + redirectUrl: string, + responseHeaders: any) => void): this; on(event: 'response', listener: ( /** * An object representing the HTTP response message. */ - response?: IncomingMessage) => void): this; + response: IncomingMessage) => void): this; once(event: 'response', listener: ( /** * An object representing the HTTP response message. */ - response?: IncomingMessage) => void): this; + response: IncomingMessage) => void): this; addListener(event: 'response', listener: ( /** * An object representing the HTTP response message. */ - response?: IncomingMessage) => void): this; + response: IncomingMessage) => void): this; removeListener(event: 'response', listener: ( /** * An object representing the HTTP response message. */ - response?: IncomingMessage) => void): this; + response: IncomingMessage) => void): this; constructor(options: any | string); /** * Cancels an ongoing HTTP transaction. If the request has already emitted the @@ -1771,19 +1771,19 @@ declare namespace Electron { * Once all child processes have acknowledged the captureMonitoringSnapshot request * the callback will be called with a file that contains the traced data. */ - captureMonitoringSnapshot(resultFilePath: string, callback: (resultFilePath?: string) => void): void; + captureMonitoringSnapshot(resultFilePath: string, callback: (resultFilePath: string) => void): void; /** * Get a set of category groups. The category groups can change as new code paths * are reached. Once all child processes have acknowledged the getCategories * request the callback is invoked with an array of category groups. */ - getCategories(callback: (categories?: string[]) => void): void; + getCategories(callback: (categories: string[]) => void): void; /** * Get the maximum usage across processes of trace buffer as a percentage of the * full state. When the TraceBufferUsage value is determined the callback is * called. */ - getTraceBufferUsage(callback: (value?: number, percentage?: number) => void): void; + getTraceBufferUsage(callback: (value: number, percentage: number) => void): void; /** * Start monitoring on all processes. Monitoring begins immediately locally and * asynchronously on child processes as soon as they receive the startMonitoring @@ -1825,7 +1825,7 @@ declare namespace Electron { * is not empty or into a temporary file. The actual file path will be passed to * callback if it's not null. */ - stopRecording(resultFilePath: string, callback: (resultFilePath?: string) => void): void; + stopRecording(resultFilePath: string, callback: (resultFilePath: string) => void): void; } interface Cookie { @@ -1852,7 +1852,7 @@ declare namespace Electron { /** * The name of the cookie. */ - name?: string; + name: string; /** * The path of the cookie. */ @@ -1869,7 +1869,7 @@ declare namespace Electron { /** * The value of the cookie. */ - value?: string; + value: string; } class Cookies extends EventEmitter { @@ -1880,58 +1880,58 @@ declare namespace Electron { * Emitted when a cookie is changed because it was added, edited, removed, or * expired. */ - on(event: 'changed', listener: (event?: Event, + on(event: 'changed', listener: (event: Event, /** * The cookie that was changed */ - cookie?: Cookie, + cookie: Cookie, /** * The cause of the change with one of the following values: */ - cause?: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), + cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), /** * `true` if the cookie was removed, `false` otherwise. */ - removed?: boolean) => void): this; - once(event: 'changed', listener: (event?: Event, + removed: boolean) => void): this; + once(event: 'changed', listener: (event: Event, /** * The cookie that was changed */ - cookie?: Cookie, + cookie: Cookie, /** * The cause of the change with one of the following values: */ - cause?: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), + cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), /** * `true` if the cookie was removed, `false` otherwise. */ - removed?: boolean) => void): this; - addListener(event: 'changed', listener: (event?: Event, + removed: boolean) => void): this; + addListener(event: 'changed', listener: (event: Event, /** * The cookie that was changed */ - cookie?: Cookie, + cookie: Cookie, /** * The cause of the change with one of the following values: */ - cause?: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), + cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), /** * `true` if the cookie was removed, `false` otherwise. */ - removed?: boolean) => void): this; - removeListener(event: 'changed', listener: (event?: Event, + removed: boolean) => void): this; + removeListener(event: 'changed', listener: (event: Event, /** * The cookie that was changed */ - cookie?: Cookie, + cookie: Cookie, /** * The cause of the change with one of the following values: */ - cause?: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), + cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), /** * `true` if the cookie was removed, `false` otherwise. */ - removed?: boolean) => void): this; + removed: boolean) => void): this; /** * Writes any unwritten cookies data to disk. */ @@ -1941,7 +1941,7 @@ declare namespace Electron { * with callback(error, cookies) on complete. cookies is an Array of cookie * objects. */ - get(filter: Filter, callback: (error?: Error, cookies?: Cookies[]) => void): void; + get(filter: Filter, callback: (error: Error, cookies: Cookies[]) => void): void; /** * Removes the cookies matching url and name, callback will called with callback() * on complete. @@ -1951,7 +1951,7 @@ declare namespace Electron { * Sets a cookie with details, callback will be called with callback(error) on * complete. */ - set(details: Details, callback: (error?: Error) => void): void; + set(details: Details, callback: (error: Error) => void): void; } interface CPUUsage { @@ -1962,19 +1962,19 @@ declare namespace Electron { * The number of average idle cpu wakeups per second since the last call to * getCPUUsage. First call returns 0. */ - idleWakeupsPerSecond?: number; + idleWakeupsPerSecond: number; /** * Percentage of CPU used since the last call to getCPUUsage. First call returns 0. */ - percentCPUUsage?: number; + percentCPUUsage: number; } interface CrashReport { // Docs: http://electron.atom.io/docs/api/structures/crash-report - date?: string; - ID?: number; + date: string; + ID: number; } interface CrashReporter extends EventEmitter { @@ -2044,69 +2044,69 @@ declare namespace Electron { * Emitted when debugging session is terminated. This happens either when * webContents is closed or devtools is invoked for the attached webContents. */ - on(event: 'detach', listener: (event?: Event, + on(event: 'detach', listener: (event: Event, /** * Reason for detaching debugger. */ - reason?: string) => void): this; - once(event: 'detach', listener: (event?: Event, + reason: string) => void): this; + once(event: 'detach', listener: (event: Event, /** * Reason for detaching debugger. */ - reason?: string) => void): this; - addListener(event: 'detach', listener: (event?: Event, + reason: string) => void): this; + addListener(event: 'detach', listener: (event: Event, /** * Reason for detaching debugger. */ - reason?: string) => void): this; - removeListener(event: 'detach', listener: (event?: Event, + reason: string) => void): this; + removeListener(event: 'detach', listener: (event: Event, /** * Reason for detaching debugger. */ - reason?: string) => void): this; + reason: string) => void): this; /** * Emitted whenever debugging target issues instrumentation event. */ - on(event: 'message', listener: (event?: Event, + on(event: 'message', listener: (event: Event, /** * Method name. */ - method?: string, + method: string, /** * Event parameters defined by the 'parameters' attribute in the remote debugging * protocol. */ - params?: any) => void): this; - once(event: 'message', listener: (event?: Event, + params: any) => void): this; + once(event: 'message', listener: (event: Event, /** * Method name. */ - method?: string, + method: string, /** * Event parameters defined by the 'parameters' attribute in the remote debugging * protocol. */ - params?: any) => void): this; - addListener(event: 'message', listener: (event?: Event, + params: any) => void): this; + addListener(event: 'message', listener: (event: Event, /** * Method name. */ - method?: string, + method: string, /** * Event parameters defined by the 'parameters' attribute in the remote debugging * protocol. */ - params?: any) => void): this; - removeListener(event: 'message', listener: (event?: Event, + params: any) => void): this; + removeListener(event: 'message', listener: (event: Event, /** * Method name. */ - method?: string, + method: string, /** * Event parameters defined by the 'parameters' attribute in the remote debugging * protocol. */ - params?: any) => void): this; + params: any) => void): this; /** * Attaches the debugger to the webContents. */ @@ -2119,7 +2119,7 @@ declare namespace Electron { /** * Send given command to the debugging target. */ - sendCommand(method: string, commandParams?: any, callback?: (error?: any, result?: any) => void): void; + sendCommand(method: string, commandParams?: any, callback?: (error: any, result: any) => void): void; } interface DesktopCapturer extends EventEmitter { @@ -2132,7 +2132,7 @@ declare namespace Electron { * DesktopCapturerSource objects, each DesktopCapturerSource represents a screen or * an individual window that can be captured. */ - getSources(options: SourcesOptions, callback: (error?: Error, sources?: DesktopCapturerSource[]) => void): void; + getSources(options: SourcesOptions, callback: (error: Error, sources: DesktopCapturerSource[]) => void): void; } interface DesktopCapturerSource { @@ -2140,22 +2140,24 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/structures/desktop-capturer-source /** - * The identifier of a window or screen that can be used as a constraint when - * calling []. The format of the identifier will be or , where is a random - * generated number. + * The identifier of a window or screen that can be used as a chromeMediaSourceId + * constraint when calling [navigator.webkitGetUserMedia]. The format of the + * identifier will be window:XX or screen:XX, where XX is a random generated + * number. */ - id?: string; + id: string; /** - * A screen source will be named either or , while the name of a window source will - * match the window title. + * A screen source will be named either Entire Screen or Screen , while the + * name of a window source will match the window title. */ - name?: string; + name: string; /** * A thumbnail image. There is no guarantee that the size of the thumbnail is the - * same as the specified in the passed to . The actual size depends on the scale of - * the screen or window. + * same as the thumbnailSize specified in the options passed to + * desktopCapturer.getSources. The actual size depends on the scale of the screen + * or window. */ - thumbnail?: NativeImage; + thumbnail: NativeImage; } interface Dialog extends EventEmitter { @@ -2200,7 +2202,7 @@ declare namespace Electron { * is passed, the API call will be asynchronous and the result will be passed via * callback(response). */ - showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions, callback?: (response?: number, checkboxChecked?: boolean) => void): number; + showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions, callback?: (response: number, checkboxChecked: boolean) => void): number; /** * Shows a message box, it will block the process until the message box is closed. * It returns the index of the clicked button. The browserWindow argument allows @@ -2208,7 +2210,7 @@ declare namespace Electron { * is passed, the API call will be asynchronous and the result will be passed via * callback(response). */ - showMessageBox(options: MessageBoxOptions, callback?: (response?: number, checkboxChecked?: boolean) => void): number; + showMessageBox(options: MessageBoxOptions, callback?: (response: number, checkboxChecked: boolean) => void): number; /** * The browserWindow argument allows the dialog to attach itself to a parent * window, making it modal. The filters specifies an array of file types that can @@ -2221,7 +2223,7 @@ declare namespace Electron { * file selector and a directory selector, so if you set properties to ['openFile', * 'openDirectory'] on these platforms, a directory selector will be shown. */ - showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions, callback?: (filePaths?: string[]) => void): string[]; + showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions, callback?: (filePaths: string[]) => void): string[]; /** * The browserWindow argument allows the dialog to attach itself to a parent * window, making it modal. The filters specifies an array of file types that can @@ -2234,7 +2236,7 @@ declare namespace Electron { * file selector and a directory selector, so if you set properties to ['openFile', * 'openDirectory'] on these platforms, a directory selector will be shown. */ - showOpenDialog(options: OpenDialogOptions, callback?: (filePaths?: string[]) => void): string[]; + showOpenDialog(options: OpenDialogOptions, callback?: (filePaths: string[]) => void): string[]; /** * The browserWindow argument allows the dialog to attach itself to a parent * window, making it modal. The filters specifies an array of file types that can @@ -2242,7 +2244,7 @@ declare namespace Electron { * the API call will be asynchronous and the result will be passed via * callback(filename) */ - showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions, callback?: (filename?: string) => void): string; + showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions, callback?: (filename: string) => void): string; /** * The browserWindow argument allows the dialog to attach itself to a parent * window, making it modal. The filters specifies an array of file types that can @@ -2250,33 +2252,33 @@ declare namespace Electron { * the API call will be asynchronous and the result will be passed via * callback(filename) */ - showSaveDialog(options: SaveDialogOptions, callback?: (filename?: string) => void): string; + showSaveDialog(options: SaveDialogOptions, callback?: (filename: string) => void): string; } interface Display { // Docs: http://electron.atom.io/docs/api/structures/display - bounds?: Rectangle; + bounds: Rectangle; /** * Unique identifier associated with the display. */ - id?: number; + id: number; /** * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees. */ - rotation?: number; + rotation: number; /** * Output device's pixel scale factor. */ - scaleFactor?: number; - size?: Size; + scaleFactor: number; + size: Size; /** - * Can be , , . + * Can be available, unavailable, unknown. */ - touchSupport?: ('available' | 'unavailable' | 'unknown'); - workArea?: Rectangle; - workAreaSize?: Size; + touchSupport: ('available' | 'unavailable' | 'unknown'); + workArea: Rectangle; + workAreaSize: Size; } class DownloadItem extends EventEmitter { @@ -2288,26 +2290,26 @@ declare namespace Electron { * download, a cancelled download (via downloadItem.cancel()), and interrupted * download that can't be resumed. The state can be one of following: */ - on(event: 'done', listener: (event?: Event, - state?: string) => void): this; - once(event: 'done', listener: (event?: Event, - state?: string) => void): this; - addListener(event: 'done', listener: (event?: Event, - state?: string) => void): this; - removeListener(event: 'done', listener: (event?: Event, - state?: string) => void): this; + on(event: 'done', listener: (event: Event, + state: string) => void): this; + once(event: 'done', listener: (event: Event, + state: string) => void): this; + addListener(event: 'done', listener: (event: Event, + state: string) => void): this; + removeListener(event: 'done', listener: (event: Event, + state: string) => void): this; /** * Emitted when the download has been updated and is not done. The state can be one * of following: */ - on(event: 'updated', listener: (event?: Event, - state?: string) => void): this; - once(event: 'updated', listener: (event?: Event, - state?: string) => void): this; - addListener(event: 'updated', listener: (event?: Event, - state?: string) => void): this; - removeListener(event: 'updated', listener: (event?: Event, - state?: string) => void): this; + on(event: 'updated', listener: (event: Event, + state: string) => void): this; + once(event: 'updated', listener: (event: Event, + state: string) => void): this; + addListener(event: 'updated', listener: (event: Event, + state: string) => void): this; + removeListener(event: 'updated', listener: (event: Event, + state: string) => void): this; /** * Cancels the download operation. */ @@ -2365,8 +2367,8 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/structures/file-filter - extensions?: string[]; - name?: string; + extensions: string[]; + name: string; } interface GlobalShortcut extends EventEmitter { @@ -2416,22 +2418,22 @@ declare namespace Electron { /** * A chunk of response body's data. */ - chunk?: Buffer) => void): this; + chunk: Buffer) => void): this; once(event: 'data', listener: ( /** * A chunk of response body's data. */ - chunk?: Buffer) => void): this; + chunk: Buffer) => void): this; addListener(event: 'data', listener: ( /** * A chunk of response body's data. */ - chunk?: Buffer) => void): this; + chunk: Buffer) => void): this; removeListener(event: 'data', listener: ( /** * A chunk of response body's data. */ - chunk?: Buffer) => void): this; + chunk: Buffer) => void): this; /** * Indicates that response body has ended. */ @@ -2465,27 +2467,27 @@ declare namespace Electron { /** * Then number of I/O other operations. */ - otherOperationCount?: number; + otherOperationCount: number; /** * Then number of I/O other transfers. */ - otherTransferCount?: number; + otherTransferCount: number; /** * The number of I/O read operations. */ - readOperationCount?: number; + readOperationCount: number; /** * The number of I/O read transfers. */ - readTransferCount?: number; + readTransferCount: number; /** * The number of I/O write operations. */ - writeOperationCount?: number; + writeOperationCount: number; /** * The number of I/O write transfers. */ - writeTransferCount?: number; + writeTransferCount: number; } interface IpcMain extends EventEmitter { @@ -2564,11 +2566,11 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/structures/jump-list-category /** - * Array of objects if is or , otherwise it should be omitted. + * Array of objects if type is tasks or custom, otherwise it should be omitted. */ items?: JumpListItem[]; /** - * Must be set if is , otherwise it should be omitted. + * Must be set if type is custom, otherwise it should be omitted. */ name?: string; /** @@ -2582,11 +2584,13 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/structures/jump-list-item /** - * The command line arguments when is executed. Should only be set if is . + * The command line arguments when program is executed. Should only be set if type + * is task. */ args?: string; /** - * Description of the task (displayed in a tooltip). Should only be set if is . + * Description of the task (displayed in a tooltip). Should only be set if type is + * task. */ description?: string; /** @@ -2598,22 +2602,22 @@ declare namespace Electron { iconIndex?: number; /** * The absolute path to an icon to be displayed in a Jump List, which can be an - * arbitrary resource file that contains an icon (e.g. , , ). You can usually - * specify to show the program icon. + * arbitrary resource file that contains an icon (e.g. .ico, .exe, .dll). You can + * usually specify process.execPath to show the program icon. */ iconPath?: string; /** - * Path of the file to open, should only be set if is . + * Path of the file to open, should only be set if type is file. */ path?: string; /** - * Path of the program to execute, usually you should specify which opens the - * current program. Should only be set if is . + * Path of the program to execute, usually you should specify process.execPath + * which opens the current program. Should only be set if type is task. */ program?: string; /** - * The text to be displayed for the item in the Jump List. Should only be set if is - * . + * The text to be displayed for the item in the Jump List. Should only be set if + * type is task. */ title?: string; /** @@ -2629,34 +2633,34 @@ declare namespace Electron { /** * The maximum amount of memory that has ever been pinned to actual physical RAM. */ - peakWorkingSetSize?: number; + peakWorkingSetSize: number; + /** + * Process id of the process. + */ + pid: number; /** * The amount of memory not shared by other processes, such as JS heap or HTML * content. */ - privateBytes?: number; + privateBytes: number; /** * The amount of memory shared between processes, typically memory consumed by the * Electron code itself */ - sharedBytes?: number; - /** - * Process id of the process. - */ - workingSetSize?: number; + sharedBytes: number; /** * The amount of memory currently pinned to actual physical RAM. */ - workingSetSize?: number; + workingSetSize: number; } interface MemoryUsageDetails { // Docs: http://electron.atom.io/docs/api/structures/memory-usage-details - count?: number; - liveSize?: number; - size?: number; + count: number; + liveSize: number; + size: number; } class Menu { @@ -2728,11 +2732,11 @@ declare namespace Electron { /** * The actual Buffer content */ - data?: Buffer; + data: Buffer; /** * The mimeType of the Buffer that you are sending */ - mimeType?: string; + mimeType: string; } class NativeImage { @@ -2750,7 +2754,7 @@ declare namespace Electron { /** * Creates a new NativeImage instance from dataURL. */ - static createFromDataURL(dataURL: string): void; + static createFromDataURL(dataURL: string): NativeImage; /** * Creates a new NativeImage instance from a file located at path. This method * returns an empty image if the path does not exist, cannot be read, or is not a @@ -2812,8 +2816,8 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/structures/point - x?: number; - y?: number; + x: number; + y: number; } interface PowerMonitor extends EventEmitter { @@ -2879,11 +2883,11 @@ declare namespace Electron { /** * Memory information of the process. */ - memory?: MemoryInfo; + memory: MemoryInfo; /** * Process id of the process. */ - pid?: number; + pid: number; } interface Protocol extends EventEmitter { @@ -2894,34 +2898,34 @@ declare namespace Electron { * Intercepts scheme protocol and uses handler as the protocol's new handler which * sends a Buffer as a response. */ - interceptBufferProtocol(scheme: string, handler: (request?: InterceptBufferProtocolRequest, callback?: (buffer?: Buffer) => void) => void, completion?: (error?: Error) => void): void; + interceptBufferProtocol(scheme: string, handler: (request: InterceptBufferProtocolRequest, callback: (buffer?: Buffer) => void) => void, completion?: (error: Error) => void): void; /** * Intercepts scheme protocol and uses handler as the protocol's new handler which * sends a file as a response. */ - interceptFileProtocol(scheme: string, handler: (request?: InterceptFileProtocolRequest, callback?: (filePath?: string) => void) => void, completion?: (error?: Error) => void): void; + interceptFileProtocol(scheme: string, handler: (request: InterceptFileProtocolRequest, callback: (filePath: string) => void) => void, completion?: (error: Error) => void): void; /** * Intercepts scheme protocol and uses handler as the protocol's new handler which * sends a new HTTP request as a response. */ - interceptHttpProtocol(scheme: string, handler: (request?: InterceptHttpProtocolRequest, callback?: (redirectRequest?: RedirectRequest) => void) => void, completion?: (error?: Error) => void): void; + interceptHttpProtocol(scheme: string, handler: (request: InterceptHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void; /** * Intercepts scheme protocol and uses handler as the protocol's new handler which * sends a String as a response. */ - interceptStringProtocol(scheme: string, handler: (request?: InterceptStringProtocolRequest, callback?: (data?: string) => void) => void, completion?: (error?: Error) => void): void; + interceptStringProtocol(scheme: string, handler: (request: InterceptStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void; /** * The callback will be called with a boolean that indicates whether there is * already a handler for scheme. */ - isProtocolHandled(scheme: string, callback: (error?: Error) => void): void; + isProtocolHandled(scheme: string, callback: (error: Error) => void): void; /** * Registers a protocol of scheme that will send a Buffer as a response. The usage * is the same with registerFileProtocol, except that the callback should be called * with either a Buffer object or an object that has the data, mimeType, and * charset properties. Example: */ - registerBufferProtocol(scheme: string, handler: (request?: RegisterBufferProtocolRequest, callback?: (buffer?: Buffer | MimeTypedBuffer) => void) => void, completion?: (error?: Error) => void): void; + registerBufferProtocol(scheme: string, handler: (request: RegisterBufferProtocolRequest, callback: (buffer?: Buffer | MimeTypedBuffer) => void) => void, completion?: (error: Error) => void): void; /** * Registers a protocol of scheme that will send the file as a response. The * handler will be called with handler(request, callback) when a request is going @@ -2937,7 +2941,7 @@ declare namespace Electron { * want to call protocol.registerStandardSchemes to have your scheme treated as a * standard scheme. */ - registerFileProtocol(scheme: string, handler: (request?: RegisterFileProtocolRequest, callback?: (filePath?: string) => void) => void, completion?: (error?: Error) => void): void; + registerFileProtocol(scheme: string, handler: (request: RegisterFileProtocolRequest, callback: (filePath?: string) => void) => void, completion?: (error: Error) => void): void; /** * Registers a protocol of scheme that will send an HTTP request as a response. The * usage is the same with registerFileProtocol, except that the callback should be @@ -2946,7 +2950,7 @@ declare namespace Electron { * current session. If you want the request to have a different session you should * set session to null. For POST requests the uploadData object must be provided. */ - registerHttpProtocol(scheme: string, handler: (request?: RegisterHttpProtocolRequest, callback?: (redirectRequest?: RedirectRequest) => void) => void, completion?: (error?: Error) => void): void; + registerHttpProtocol(scheme: string, handler: (request: RegisterHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void; registerServiceWorkerSchemes(schemes: string[]): void; /** * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example @@ -2971,31 +2975,31 @@ declare namespace Electron { * with either a String or an object that has the data, mimeType, and charset * properties. */ - registerStringProtocol(scheme: string, handler: (request?: RegisterStringProtocolRequest, callback?: (data?: string) => void) => void, completion?: (error?: Error) => void): void; + registerStringProtocol(scheme: string, handler: (request: RegisterStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void; /** * Remove the interceptor installed for scheme and restore its original handler. */ - uninterceptProtocol(scheme: string, completion?: (error?: Error) => void): void; + uninterceptProtocol(scheme: string, completion?: (error: Error) => void): void; /** * Unregisters the custom protocol of scheme. */ - unregisterProtocol(scheme: string, completion?: (error?: Error) => void): void; + unregisterProtocol(scheme: string, completion?: (error: Error) => void): void; } interface Rectangle { // Docs: http://electron.atom.io/docs/api/structures/rectangle - height?: number; - width?: number; + height: number; + width: number; /** * The x coordinate of the origin of the rectangle */ - x?: number; + x: number; /** * The y coordinate of the origin of the rectangle */ - y?: number; + y: number; } interface Remote extends MainInterface { @@ -3024,11 +3028,11 @@ declare namespace Electron { * Origin of the server whose associated client certificate must be removed from * the cache. */ - origin?: string; + origin: string; /** - * . + * clientCertificate. */ - type?: string; + type: string; } interface RemovePassword { @@ -3041,23 +3045,24 @@ declare namespace Electron { */ origin?: string; /** - * Credentials of the authentication. Must be provided if removing by . + * Credentials of the authentication. Must be provided if removing by origin. */ password?: string; /** - * Realm of the authentication. Must be provided if removing by . + * Realm of the authentication. Must be provided if removing by origin. */ realm?: string; /** - * Scheme of the authentication. Can be , , , . Must be provided if removing by . + * Scheme of the authentication. Can be basic, digest, ntlm, negotiate. Must be + * provided if removing by origin. */ scheme?: ('basic' | 'digest' | 'ntlm' | 'negotiate'); /** - * . + * password. */ - type?: string; + type: string; /** - * Credentials of the authentication. Must be provided if removing by . + * Credentials of the authentication. Must be provided if removing by origin. */ username?: string; } @@ -3069,42 +3074,42 @@ declare namespace Electron { /** * Emitted when newDisplay has been added. */ - on(event: 'display-added', listener: (event?: Event, - newDisplay?: Display) => void): this; - once(event: 'display-added', listener: (event?: Event, - newDisplay?: Display) => void): this; - addListener(event: 'display-added', listener: (event?: Event, - newDisplay?: Display) => void): this; - removeListener(event: 'display-added', listener: (event?: Event, - newDisplay?: Display) => void): this; + on(event: 'display-added', listener: (event: Event, + newDisplay: Display) => void): this; + once(event: 'display-added', listener: (event: Event, + newDisplay: Display) => void): this; + addListener(event: 'display-added', listener: (event: Event, + newDisplay: Display) => void): this; + removeListener(event: 'display-added', listener: (event: Event, + newDisplay: Display) => void): this; /** * Emitted when one or more metrics change in a display. The changedMetrics is an * array of strings that describe the changes. Possible changes are bounds, * workArea, scaleFactor and rotation. */ - on(event: 'display-metrics-changed', listener: (event?: Event, - display?: Display, - changedMetrics?: string[]) => void): this; - once(event: 'display-metrics-changed', listener: (event?: Event, - display?: Display, - changedMetrics?: string[]) => void): this; - addListener(event: 'display-metrics-changed', listener: (event?: Event, - display?: Display, - changedMetrics?: string[]) => void): this; - removeListener(event: 'display-metrics-changed', listener: (event?: Event, - display?: Display, - changedMetrics?: string[]) => void): this; + on(event: 'display-metrics-changed', listener: (event: Event, + display: Display, + changedMetrics: string[]) => void): this; + once(event: 'display-metrics-changed', listener: (event: Event, + display: Display, + changedMetrics: string[]) => void): this; + addListener(event: 'display-metrics-changed', listener: (event: Event, + display: Display, + changedMetrics: string[]) => void): this; + removeListener(event: 'display-metrics-changed', listener: (event: Event, + display: Display, + changedMetrics: string[]) => void): this; /** * Emitted when oldDisplay has been removed. */ - on(event: 'display-removed', listener: (event?: Event, - oldDisplay?: Display) => void): this; - once(event: 'display-removed', listener: (event?: Event, - oldDisplay?: Display) => void): this; - addListener(event: 'display-removed', listener: (event?: Event, - oldDisplay?: Display) => void): this; - removeListener(event: 'display-removed', listener: (event?: Event, - oldDisplay?: Display) => void): this; + on(event: 'display-removed', listener: (event: Event, + oldDisplay: Display) => void): this; + once(event: 'display-removed', listener: (event: Event, + oldDisplay: Display) => void): this; + addListener(event: 'display-removed', listener: (event: Event, + oldDisplay: Display) => void): this; + removeListener(event: 'display-removed', listener: (event: Event, + oldDisplay: Display) => void): this; getAllDisplays(): Display[]; /** * The current absolute position of the mouse pointer. @@ -3169,18 +3174,18 @@ declare namespace Electron { * event.preventDefault() will cancel the download and item will not be available * from next tick of the process. */ - on(event: 'will-download', listener: (event?: Event, - item?: DownloadItem, - webContents?: WebContents) => void): this; - once(event: 'will-download', listener: (event?: Event, - item?: DownloadItem, - webContents?: WebContents) => void): this; - addListener(event: 'will-download', listener: (event?: Event, - item?: DownloadItem, - webContents?: WebContents) => void): this; - removeListener(event: 'will-download', listener: (event?: Event, - item?: DownloadItem, - webContents?: WebContents) => void): this; + on(event: 'will-download', listener: (event: Event, + item: DownloadItem, + webContents: WebContents) => void): this; + once(event: 'will-download', listener: (event: Event, + item: DownloadItem, + webContents: WebContents) => void): this; + addListener(event: 'will-download', listener: (event: Event, + item: DownloadItem, + webContents: WebContents) => void): this; + removeListener(event: 'will-download', listener: (event: Event, + item: DownloadItem, + webContents: WebContents) => void): this; /** * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate * authentication. @@ -3223,17 +3228,17 @@ declare namespace Electron { * Writes any unwritten DOMStorage data to disk. */ flushStorageData(): void; - getBlobData(identifier: string, callback: (result?: Buffer) => void): Blob; + getBlobData(identifier: string, callback: (result: Buffer) => void): Blob; /** * Callback is invoked with the session's current cache size. */ - getCacheSize(callback: (size?: number) => void): void; + getCacheSize(callback: (size: number) => void): void; getUserAgent(): string; /** * Resolves the proxy information for url. The callback will be called with * callback(proxy) when the request is performed. */ - resolveProxy(url: string, callback: (proxy?: string) => void): void; + resolveProxy(url: string, callback: (proxy: string) => void): void; /** * Sets the certificate verify proc for session, the proc will be called with * proc(request, callback) whenever a server certificate verification is requested. @@ -3241,7 +3246,7 @@ declare namespace Electron { * Calling setCertificateVerifyProc(null) will revert back to default certificate * verify proc. */ - setCertificateVerifyProc(proc: (request?: CertificateVerifyProcRequest, callback?: (verificationResult?: number) => void) => void): void; + setCertificateVerifyProc(proc: (request: CertificateVerifyProcRequest, callback: (verificationResult: number) => void) => void): void; /** * Sets download saving directory. By default, the download directory will be the * Downloads under the respective app folder. @@ -3252,7 +3257,7 @@ declare namespace Electron { * session. Calling callback(true) will allow the permission and callback(false) * will reject it. */ - setPermissionRequestHandler(handler: (webContents?: WebContents, permission?: string, callback?: (permissionGranted?: boolean) => void) => void): void; + setPermissionRequestHandler(handler: (webContents: WebContents, permission: string, callback: (permissionGranted: boolean) => void) => void): void; /** * Sets the proxy settings. When pacScript and proxyRules are provided together, * the proxyRules option is ignored and pacScript configuration is applied. The @@ -3289,7 +3294,7 @@ declare namespace Electron { * Open the given external protocol URL in the desktop's default manner. (For * example, mailto: URLs in the user's default mail agent). */ - openExternal(url: string, options?: OpenExternalOptions, callback?: (error?: Error) => void): boolean; + openExternal(url: string, options?: OpenExternalOptions, callback?: (error: Error) => void): boolean; /** * Open the given file in the desktop's default manner. */ @@ -3322,8 +3327,8 @@ declare namespace Electron { */ appUserModelId?: string; /** - * The arguments to be applied to when launching from this shortcut. Default is - * empty. + * The arguments to be applied to target when launching from this shortcut. Default + * is empty. */ args?: string; /** @@ -3335,80 +3340,80 @@ declare namespace Electron { */ description?: string; /** - * The path to the icon, can be a DLL or EXE. and have to be set together. Default - * is empty, which uses the target's icon. + * The path to the icon, can be a DLL or EXE. icon and iconIndex have to be set + * together. Default is empty, which uses the target's icon. */ icon?: string; /** - * The resource ID of icon when is a DLL or EXE. Default is 0. + * The resource ID of icon when icon is a DLL or EXE. Default is 0. */ iconIndex?: number; /** * The target to launch from this shortcut. */ - target?: string; + target: string; } interface Size { // Docs: http://electron.atom.io/docs/api/structures/size - height?: number; - width?: number; + height: number; + width: number; } interface SystemPreferences extends EventEmitter { // Docs: http://electron.atom.io/docs/api/system-preferences - on(event: 'accent-color-changed', listener: (event?: Event, + on(event: 'accent-color-changed', listener: (event: Event, /** * The new RGBA color the user assigned to be their system accent color. */ - newColor?: string) => void): this; - once(event: 'accent-color-changed', listener: (event?: Event, + newColor: string) => void): this; + once(event: 'accent-color-changed', listener: (event: Event, /** * The new RGBA color the user assigned to be their system accent color. */ - newColor?: string) => void): this; - addListener(event: 'accent-color-changed', listener: (event?: Event, + newColor: string) => void): this; + addListener(event: 'accent-color-changed', listener: (event: Event, /** * The new RGBA color the user assigned to be their system accent color. */ - newColor?: string) => void): this; - removeListener(event: 'accent-color-changed', listener: (event?: Event, + newColor: string) => void): this; + removeListener(event: 'accent-color-changed', listener: (event: Event, /** * The new RGBA color the user assigned to be their system accent color. */ - newColor?: string) => void): this; - on(event: 'color-changed', listener: (event?: Event) => void): this; - once(event: 'color-changed', listener: (event?: Event) => void): this; - addListener(event: 'color-changed', listener: (event?: Event) => void): this; - removeListener(event: 'color-changed', listener: (event?: Event) => void): this; - on(event: 'inverted-color-scheme-changed', listener: (event?: Event, + newColor: string) => void): this; + on(event: 'color-changed', listener: (event: Event) => void): this; + once(event: 'color-changed', listener: (event: Event) => void): this; + addListener(event: 'color-changed', listener: (event: Event) => void): this; + removeListener(event: 'color-changed', listener: (event: Event) => void): this; + on(event: 'inverted-color-scheme-changed', listener: (event: Event, /** * `true` if an inverted color scheme, such as a high contrast theme, is being * used, `false` otherwise. */ - invertedColorScheme?: boolean) => void): this; - once(event: 'inverted-color-scheme-changed', listener: (event?: Event, + invertedColorScheme: boolean) => void): this; + once(event: 'inverted-color-scheme-changed', listener: (event: Event, /** * `true` if an inverted color scheme, such as a high contrast theme, is being * used, `false` otherwise. */ - invertedColorScheme?: boolean) => void): this; - addListener(event: 'inverted-color-scheme-changed', listener: (event?: Event, + invertedColorScheme: boolean) => void): this; + addListener(event: 'inverted-color-scheme-changed', listener: (event: Event, /** * `true` if an inverted color scheme, such as a high contrast theme, is being * used, `false` otherwise. */ - invertedColorScheme?: boolean) => void): this; - removeListener(event: 'inverted-color-scheme-changed', listener: (event?: Event, + invertedColorScheme: boolean) => void): this; + removeListener(event: 'inverted-color-scheme-changed', listener: (event: Event, /** * `true` if an inverted color scheme, such as a high contrast theme, is being * used, `false` otherwise. */ - invertedColorScheme?: boolean) => void): this; + invertedColorScheme: boolean) => void): this; getAccentColor(): string; getColor(color: '3d-dark-shadow' | '3d-face' | '3d-highlight' | '3d-light' | '3d-shadow' | 'active-border' | 'active-caption' | 'active-caption-gradient' | 'app-workspace' | 'button-text' | 'caption-text' | 'desktop' | 'disabled-text' | 'highlight' | 'highlight-text' | 'hotlight' | 'inactive-border' | 'inactive-caption' | 'inactive-caption-gradient' | 'inactive-caption-text' | 'info-background' | 'info-text' | 'menu' | 'menu-highlight' | 'menubar' | 'menu-text' | 'scrollbar' | 'window' | 'window-frame' | 'window-text'): string; /** @@ -3446,7 +3451,7 @@ declare namespace Electron { * Same as subscribeNotification, but uses NSNotificationCenter for local defaults. * This is necessary for events such as NSUserDefaultsDidChangeNotification */ - subscribeLocalNotification(event: string, callback: (event?: string, userInfo?: any) => void): void; + subscribeLocalNotification(event: string, callback: (event: string, userInfo: any) => void): void; /** * Subscribes to native notifications of macOS, callback will be called with * callback(event, userInfo) when the corresponding event happens. The userInfo is @@ -3455,7 +3460,7 @@ declare namespace Electron { * unsubscribe the event. Under the hood this API subscribes to * NSDistributedNotificationCenter, example values of event are: */ - subscribeNotification(event: string, callback: (event?: string, userInfo?: any) => void): void; + subscribeNotification(event: string, callback: (event: string, userInfo: any) => void): void; /** * Same as unsubscribeNotification, but removes the subscriber from * NSNotificationCenter. @@ -3472,49 +3477,50 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/structures/task /** - * The command line arguments when is executed. + * The command line arguments when program is executed. */ - arguments?: string; + arguments: string; /** * Description of this task. */ - description?: string; + description: string; /** * The icon index in the icon file. If an icon file consists of two or more icons, * set this value to identify the icon. If an icon file consists of one icon, this * value is 0. */ - iconIndex?: number; + iconIndex: number; /** * The absolute path to an icon to be displayed in a JumpList, which can be an - * arbitrary resource file that contains an icon. You can usually specify to show - * the icon of the program. + * arbitrary resource file that contains an icon. You can usually specify + * process.execPath to show the icon of the program. */ - iconPath?: string; + iconPath: string; /** - * Path of the program to execute, usually you should specify which opens the - * current program. + * Path of the program to execute, usually you should specify process.execPath + * which opens the current program. */ - program?: string; + program: string; /** * The string to be displayed in a JumpList. */ - title?: string; + title: string; } interface ThumbarButton { // Docs: http://electron.atom.io/docs/api/structures/thumbar-button - click?: Function; + click: Function; /** - * Control specific states and behaviors of the button. By default, it is . + * Control specific states and behaviors of the button. By default, it is + * ['enabled']. */ flags?: string[]; /** * The icon showing in thumbnail toolbar. */ - icon?: NativeImage; + icon: NativeImage; /** * The text of the button's tooltip. */ @@ -3652,49 +3658,49 @@ declare namespace Electron { /** * Emitted when the tray icon is clicked. */ - on(event: 'click', listener: (event?: Event, + on(event: 'click', listener: (event: Event, /** * The bounds of tray icon */ - bounds?: Rectangle) => void): this; - once(event: 'click', listener: (event?: Event, + bounds: Rectangle) => void): this; + once(event: 'click', listener: (event: Event, /** * The bounds of tray icon */ - bounds?: Rectangle) => void): this; - addListener(event: 'click', listener: (event?: Event, + bounds: Rectangle) => void): this; + addListener(event: 'click', listener: (event: Event, /** * The bounds of tray icon */ - bounds?: Rectangle) => void): this; - removeListener(event: 'click', listener: (event?: Event, + bounds: Rectangle) => void): this; + removeListener(event: 'click', listener: (event: Event, /** * The bounds of tray icon */ - bounds?: Rectangle) => void): this; + bounds: Rectangle) => void): this; /** * Emitted when the tray icon is double clicked. */ - on(event: 'double-click', listener: (event?: Event, + on(event: 'double-click', listener: (event: Event, /** * The bounds of tray icon */ - bounds?: Rectangle) => void): this; - once(event: 'double-click', listener: (event?: Event, + bounds: Rectangle) => void): this; + once(event: 'double-click', listener: (event: Event, /** * The bounds of tray icon */ - bounds?: Rectangle) => void): this; - addListener(event: 'double-click', listener: (event?: Event, + bounds: Rectangle) => void): this; + addListener(event: 'double-click', listener: (event: Event, /** * The bounds of tray icon */ - bounds?: Rectangle) => void): this; - removeListener(event: 'double-click', listener: (event?: Event, + bounds: Rectangle) => void): this; + removeListener(event: 'double-click', listener: (event: Event, /** * The bounds of tray icon */ - bounds?: Rectangle) => void): this; + bounds: Rectangle) => void): this; /** * Emitted when a drag operation ends on the tray or ends at another location. */ @@ -3726,72 +3732,72 @@ declare namespace Electron { /** * Emitted when dragged files are dropped in the tray icon. */ - on(event: 'drop-files', listener: (event?: Event, + on(event: 'drop-files', listener: (event: Event, /** * The paths of the dropped files. */ - files?: string[]) => void): this; - once(event: 'drop-files', listener: (event?: Event, + files: string[]) => void): this; + once(event: 'drop-files', listener: (event: Event, /** * The paths of the dropped files. */ - files?: string[]) => void): this; - addListener(event: 'drop-files', listener: (event?: Event, + files: string[]) => void): this; + addListener(event: 'drop-files', listener: (event: Event, /** * The paths of the dropped files. */ - files?: string[]) => void): this; - removeListener(event: 'drop-files', listener: (event?: Event, + files: string[]) => void): this; + removeListener(event: 'drop-files', listener: (event: Event, /** * The paths of the dropped files. */ - files?: string[]) => void): this; + files: string[]) => void): this; /** * Emitted when dragged text is dropped in the tray icon. */ - on(event: 'drop-text', listener: (event?: Event, + on(event: 'drop-text', listener: (event: Event, /** * the dropped text string */ - text?: string) => void): this; - once(event: 'drop-text', listener: (event?: Event, + text: string) => void): this; + once(event: 'drop-text', listener: (event: Event, /** * the dropped text string */ - text?: string) => void): this; - addListener(event: 'drop-text', listener: (event?: Event, + text: string) => void): this; + addListener(event: 'drop-text', listener: (event: Event, /** * the dropped text string */ - text?: string) => void): this; - removeListener(event: 'drop-text', listener: (event?: Event, + text: string) => void): this; + removeListener(event: 'drop-text', listener: (event: Event, /** * the dropped text string */ - text?: string) => void): this; + text: string) => void): this; /** * Emitted when the tray icon is right clicked. */ - on(event: 'right-click', listener: (event?: Event, + on(event: 'right-click', listener: (event: Event, /** * The bounds of tray icon */ - bounds?: Rectangle) => void): this; - once(event: 'right-click', listener: (event?: Event, + bounds: Rectangle) => void): this; + once(event: 'right-click', listener: (event: Event, /** * The bounds of tray icon */ - bounds?: Rectangle) => void): this; - addListener(event: 'right-click', listener: (event?: Event, + bounds: Rectangle) => void): this; + addListener(event: 'right-click', listener: (event: Event, /** * The bounds of tray icon */ - bounds?: Rectangle) => void): this; - removeListener(event: 'right-click', listener: (event?: Event, + bounds: Rectangle) => void): this; + removeListener(event: 'right-click', listener: (event: Event, /** * The bounds of tray icon */ - bounds?: Rectangle) => void): this; + bounds: Rectangle) => void): this; constructor(image: NativeImage | string); /** * Destroys the tray icon immediately. @@ -3847,11 +3853,11 @@ declare namespace Electron { /** * UUID of blob data to upload. */ - blobUUID?: string; + blobUUID: string; /** - * . + * blob. */ - type?: string; + type: string; } interface UploadData { @@ -3861,15 +3867,15 @@ declare namespace Electron { /** * UUID of blob data. Use method to retrieve the data. */ - blobUUID?: string; + blobUUID: string; /** * Content being sent. */ - bytes?: Buffer; + bytes: Buffer; /** * Path of file being uploaded. */ - file?: string; + file: string; } interface UploadFile { @@ -3879,23 +3885,23 @@ declare namespace Electron { /** * Path of file to be uploaded. */ - filePath?: string; + filePath: string; /** - * Number of bytes to read from . Defaults to . + * Number of bytes to read from offset. Defaults to 0. */ - length?: number; + length: number; /** * Last Modification time in number of seconds sine the UNIX epoch. */ - modificationTime?: number; + modificationTime: number; /** - * Defaults to . + * Defaults to 0. */ - offset?: number; + offset: number; /** - * . + * file. */ - type?: string; + type: string; } interface UploadFileSystem { @@ -3905,23 +3911,23 @@ declare namespace Electron { /** * FileSystem url to read data for upload. */ - filsSystemURL?: string; + filsSystemURL: string; /** - * Number of bytes to read from . Defaults to . + * Number of bytes to read from offset. Defaults to 0. */ - length?: number; + length: number; /** * Last Modification time in number of seconds sine the UNIX epoch. */ - modificationTime?: number; + modificationTime: number; /** - * Defaults to . + * Defaults to 0. */ - offset?: number; + offset: number; /** - * . + * fileSystem. */ - type?: string; + type: string; } interface UploadRawData { @@ -3931,11 +3937,11 @@ declare namespace Electron { /** * Data to be uploaded. */ - bytes?: Buffer; + bytes: Buffer; /** - * . + * rawData. */ - type?: string; + type: string; } class WebContents extends EventEmitter { @@ -3950,84 +3956,84 @@ declare namespace Electron { * event.preventDefault will prevent the page keydown/keyup events from being * dispatched. */ - on(event: 'before-input-event', listener: (event?: Event, + on(event: 'before-input-event', listener: (event: Event, /** * Input properties */ - input?: Input) => void): this; - once(event: 'before-input-event', listener: (event?: Event, + input: Input) => void): this; + once(event: 'before-input-event', listener: (event: Event, /** * Input properties */ - input?: Input) => void): this; - addListener(event: 'before-input-event', listener: (event?: Event, + input: Input) => void): this; + addListener(event: 'before-input-event', listener: (event: Event, /** * Input properties */ - input?: Input) => void): this; - removeListener(event: 'before-input-event', listener: (event?: Event, + input: Input) => void): this; + removeListener(event: 'before-input-event', listener: (event: Event, /** * Input properties */ - input?: Input) => void): this; + input: Input) => void): this; /** * Emitted when failed to verify the certificate for url. The usage is the same * with the certificate-error event of app. */ - on(event: 'certificate-error', listener: (event?: Event, - url?: string, + on(event: 'certificate-error', listener: (event: Event, + url: string, /** * The error code */ - error?: string, - certificate?: Certificate, - callback?: (isTrusted?: boolean) => void) => void): this; - once(event: 'certificate-error', listener: (event?: Event, - url?: string, + error: string, + certificate: Certificate, + callback: (isTrusted: boolean) => void) => void): this; + once(event: 'certificate-error', listener: (event: Event, + url: string, /** * The error code */ - error?: string, - certificate?: Certificate, - callback?: (isTrusted?: boolean) => void) => void): this; - addListener(event: 'certificate-error', listener: (event?: Event, - url?: string, + error: string, + certificate: Certificate, + callback: (isTrusted: boolean) => void) => void): this; + addListener(event: 'certificate-error', listener: (event: Event, + url: string, /** * The error code */ - error?: string, - certificate?: Certificate, - callback?: (isTrusted?: boolean) => void) => void): this; - removeListener(event: 'certificate-error', listener: (event?: Event, - url?: string, + error: string, + certificate: Certificate, + callback: (isTrusted: boolean) => void) => void): this; + removeListener(event: 'certificate-error', listener: (event: Event, + url: string, /** * The error code */ - error?: string, - certificate?: Certificate, - callback?: (isTrusted?: boolean) => void) => void): this; + error: string, + certificate: Certificate, + callback: (isTrusted: boolean) => void) => void): this; /** * Emitted when there is a new context menu that needs to be handled. */ - on(event: 'context-menu', listener: (event?: Event, - params?: ContextMenuParams) => void): this; - once(event: 'context-menu', listener: (event?: Event, - params?: ContextMenuParams) => void): this; - addListener(event: 'context-menu', listener: (event?: Event, - params?: ContextMenuParams) => void): this; - removeListener(event: 'context-menu', listener: (event?: Event, - params?: ContextMenuParams) => void): this; + on(event: 'context-menu', listener: (event: Event, + params: ContextMenuParams) => void): this; + once(event: 'context-menu', listener: (event: Event, + params: ContextMenuParams) => void): this; + addListener(event: 'context-menu', listener: (event: Event, + params: ContextMenuParams) => void): this; + removeListener(event: 'context-menu', listener: (event: Event, + params: ContextMenuParams) => void): this; /** * Emitted when the renderer process crashes or is killed. */ - on(event: 'crashed', listener: (event?: Event, - killed?: boolean) => void): this; - once(event: 'crashed', listener: (event?: Event, - killed?: boolean) => void): this; - addListener(event: 'crashed', listener: (event?: Event, - killed?: boolean) => void): this; - removeListener(event: 'crashed', listener: (event?: Event, - killed?: boolean) => void): this; + on(event: 'crashed', listener: (event: Event, + killed: boolean) => void): this; + once(event: 'crashed', listener: (event: Event, + killed: boolean) => void): this; + addListener(event: 'crashed', listener: (event: Event, + killed: boolean) => void): this; + removeListener(event: 'crashed', listener: (event: Event, + killed: boolean) => void): this; /** * Emitted when the cursor's type changes. The type parameter can be default, * crosshair, pointer, text, wait, help, e-resize, n-resize, ne-resize, nw-resize, @@ -4040,8 +4046,8 @@ declare namespace Electron { * and scale, size and hotspot will hold additional information about the custom * cursor. */ - on(event: 'cursor-changed', listener: (event?: Event, - type?: string, + on(event: 'cursor-changed', listener: (event: Event, + type: string, image?: NativeImage, /** * scaling factor for the custom cursor @@ -4055,8 +4061,8 @@ declare namespace Electron { * coordinates of the custom cursor's hotspot */ hotspot?: Point) => void): this; - once(event: 'cursor-changed', listener: (event?: Event, - type?: string, + once(event: 'cursor-changed', listener: (event: Event, + type: string, image?: NativeImage, /** * scaling factor for the custom cursor @@ -4070,8 +4076,8 @@ declare namespace Electron { * coordinates of the custom cursor's hotspot */ hotspot?: Point) => void): this; - addListener(event: 'cursor-changed', listener: (event?: Event, - type?: string, + addListener(event: 'cursor-changed', listener: (event: Event, + type: string, image?: NativeImage, /** * scaling factor for the custom cursor @@ -4085,8 +4091,8 @@ declare namespace Electron { * coordinates of the custom cursor's hotspot */ hotspot?: Point) => void): this; - removeListener(event: 'cursor-changed', listener: (event?: Event, - type?: string, + removeListener(event: 'cursor-changed', listener: (event: Event, + type: string, image?: NativeImage, /** * scaling factor for the custom cursor @@ -4148,26 +4154,26 @@ declare namespace Electron { * cancelled, e.g. window.stop() is invoked. The full list of error codes and their * meaning is available here. */ - on(event: 'did-fail-load', listener: (event?: Event, - errorCode?: number, - errorDescription?: string, - validatedURL?: string, - isMainFrame?: boolean) => void): this; - once(event: 'did-fail-load', listener: (event?: Event, - errorCode?: number, - errorDescription?: string, - validatedURL?: string, - isMainFrame?: boolean) => void): this; - addListener(event: 'did-fail-load', listener: (event?: Event, - errorCode?: number, - errorDescription?: string, - validatedURL?: string, - isMainFrame?: boolean) => void): this; - removeListener(event: 'did-fail-load', listener: (event?: Event, - errorCode?: number, - errorDescription?: string, - validatedURL?: string, - isMainFrame?: boolean) => void): this; + on(event: 'did-fail-load', listener: (event: Event, + errorCode: number, + errorDescription: string, + validatedURL: string, + isMainFrame: boolean) => void): this; + once(event: 'did-fail-load', listener: (event: Event, + errorCode: number, + errorDescription: string, + validatedURL: string, + isMainFrame: boolean) => void): this; + addListener(event: 'did-fail-load', listener: (event: Event, + errorCode: number, + errorDescription: string, + validatedURL: string, + isMainFrame: boolean) => void): this; + removeListener(event: 'did-fail-load', listener: (event: Event, + errorCode: number, + errorDescription: string, + validatedURL: string, + isMainFrame: boolean) => void): this; /** * Emitted when the navigation is done, i.e. the spinner of the tab has stopped * spinning, and the onload event was dispatched. @@ -4179,120 +4185,120 @@ declare namespace Electron { /** * Emitted when a frame has done navigation. */ - on(event: 'did-frame-finish-load', listener: (event?: Event, - isMainFrame?: boolean) => void): this; - once(event: 'did-frame-finish-load', listener: (event?: Event, - isMainFrame?: boolean) => void): this; - addListener(event: 'did-frame-finish-load', listener: (event?: Event, - isMainFrame?: boolean) => void): this; - removeListener(event: 'did-frame-finish-load', listener: (event?: Event, - isMainFrame?: boolean) => void): this; + on(event: 'did-frame-finish-load', listener: (event: Event, + isMainFrame: boolean) => void): this; + once(event: 'did-frame-finish-load', listener: (event: Event, + isMainFrame: boolean) => void): this; + addListener(event: 'did-frame-finish-load', listener: (event: Event, + isMainFrame: boolean) => void): this; + removeListener(event: 'did-frame-finish-load', listener: (event: Event, + isMainFrame: boolean) => void): this; /** * Emitted when a redirect is received while requesting a resource. */ - on(event: 'did-get-redirect-request', listener: (event?: Event, - oldURL?: string, - newURL?: string, - isMainFrame?: boolean, - httpResponseCode?: number, - requestMethod?: string, - referrer?: string, - headers?: any) => void): this; - once(event: 'did-get-redirect-request', listener: (event?: Event, - oldURL?: string, - newURL?: string, - isMainFrame?: boolean, - httpResponseCode?: number, - requestMethod?: string, - referrer?: string, - headers?: any) => void): this; - addListener(event: 'did-get-redirect-request', listener: (event?: Event, - oldURL?: string, - newURL?: string, - isMainFrame?: boolean, - httpResponseCode?: number, - requestMethod?: string, - referrer?: string, - headers?: any) => void): this; - removeListener(event: 'did-get-redirect-request', listener: (event?: Event, - oldURL?: string, - newURL?: string, - isMainFrame?: boolean, - httpResponseCode?: number, - requestMethod?: string, - referrer?: string, - headers?: any) => void): this; + on(event: 'did-get-redirect-request', listener: (event: Event, + oldURL: string, + newURL: string, + isMainFrame: boolean, + httpResponseCode: number, + requestMethod: string, + referrer: string, + headers: any) => void): this; + once(event: 'did-get-redirect-request', listener: (event: Event, + oldURL: string, + newURL: string, + isMainFrame: boolean, + httpResponseCode: number, + requestMethod: string, + referrer: string, + headers: any) => void): this; + addListener(event: 'did-get-redirect-request', listener: (event: Event, + oldURL: string, + newURL: string, + isMainFrame: boolean, + httpResponseCode: number, + requestMethod: string, + referrer: string, + headers: any) => void): this; + removeListener(event: 'did-get-redirect-request', listener: (event: Event, + oldURL: string, + newURL: string, + isMainFrame: boolean, + httpResponseCode: number, + requestMethod: string, + referrer: string, + headers: any) => void): this; /** * Emitted when details regarding a requested resource are available. status * indicates the socket connection to download the resource. */ - on(event: 'did-get-response-details', listener: (event?: Event, - status?: boolean, - newURL?: string, - originalURL?: string, - httpResponseCode?: number, - requestMethod?: string, - referrer?: string, - headers?: any, - resourceType?: string) => void): this; - once(event: 'did-get-response-details', listener: (event?: Event, - status?: boolean, - newURL?: string, - originalURL?: string, - httpResponseCode?: number, - requestMethod?: string, - referrer?: string, - headers?: any, - resourceType?: string) => void): this; - addListener(event: 'did-get-response-details', listener: (event?: Event, - status?: boolean, - newURL?: string, - originalURL?: string, - httpResponseCode?: number, - requestMethod?: string, - referrer?: string, - headers?: any, - resourceType?: string) => void): this; - removeListener(event: 'did-get-response-details', listener: (event?: Event, - status?: boolean, - newURL?: string, - originalURL?: string, - httpResponseCode?: number, - requestMethod?: string, - referrer?: string, - headers?: any, - resourceType?: string) => void): this; + on(event: 'did-get-response-details', listener: (event: Event, + status: boolean, + newURL: string, + originalURL: string, + httpResponseCode: number, + requestMethod: string, + referrer: string, + headers: any, + resourceType: string) => void): this; + once(event: 'did-get-response-details', listener: (event: Event, + status: boolean, + newURL: string, + originalURL: string, + httpResponseCode: number, + requestMethod: string, + referrer: string, + headers: any, + resourceType: string) => void): this; + addListener(event: 'did-get-response-details', listener: (event: Event, + status: boolean, + newURL: string, + originalURL: string, + httpResponseCode: number, + requestMethod: string, + referrer: string, + headers: any, + resourceType: string) => void): this; + removeListener(event: 'did-get-response-details', listener: (event: Event, + status: boolean, + newURL: string, + originalURL: string, + httpResponseCode: number, + requestMethod: string, + referrer: string, + headers: any, + resourceType: string) => void): this; /** * Emitted when a navigation is done. This event is not emitted for in-page * navigations, such as clicking anchor links or updating the window.location.hash. * Use did-navigate-in-page event for this purpose. */ - on(event: 'did-navigate', listener: (event?: Event, - url?: string) => void): this; - once(event: 'did-navigate', listener: (event?: Event, - url?: string) => void): this; - addListener(event: 'did-navigate', listener: (event?: Event, - url?: string) => void): this; - removeListener(event: 'did-navigate', listener: (event?: Event, - url?: string) => void): this; + on(event: 'did-navigate', listener: (event: Event, + url: string) => void): this; + once(event: 'did-navigate', listener: (event: Event, + url: string) => void): this; + addListener(event: 'did-navigate', listener: (event: Event, + url: string) => void): this; + removeListener(event: 'did-navigate', listener: (event: Event, + url: string) => void): this; /** * Emitted when an in-page navigation happened. When in-page navigation happens, * the page URL changes but does not cause navigation outside of the page. Examples * of this occurring are when anchor links are clicked or when the DOM hashchange * event is triggered. */ - on(event: 'did-navigate-in-page', listener: (event?: Event, - url?: string, - isMainFrame?: boolean) => void): this; - once(event: 'did-navigate-in-page', listener: (event?: Event, - url?: string, - isMainFrame?: boolean) => void): this; - addListener(event: 'did-navigate-in-page', listener: (event?: Event, - url?: string, - isMainFrame?: boolean) => void): this; - removeListener(event: 'did-navigate-in-page', listener: (event?: Event, - url?: string, - isMainFrame?: boolean) => void): this; + on(event: 'did-navigate-in-page', listener: (event: Event, + url: string, + isMainFrame: boolean) => void): this; + once(event: 'did-navigate-in-page', listener: (event: Event, + url: string, + isMainFrame: boolean) => void): this; + addListener(event: 'did-navigate-in-page', listener: (event: Event, + url: string, + isMainFrame: boolean) => void): this; + removeListener(event: 'did-navigate-in-page', listener: (event: Event, + url: string, + isMainFrame: boolean) => void): this; /** * Corresponds to the points in time when the spinner of the tab started spinning. */ @@ -4310,41 +4316,41 @@ declare namespace Electron { /** * Emitted when the document in the given frame is loaded. */ - on(event: 'dom-ready', listener: (event?: Event) => void): this; - once(event: 'dom-ready', listener: (event?: Event) => void): this; - addListener(event: 'dom-ready', listener: (event?: Event) => void): this; - removeListener(event: 'dom-ready', listener: (event?: Event) => void): this; + on(event: 'dom-ready', listener: (event: Event) => void): this; + once(event: 'dom-ready', listener: (event: Event) => void): this; + addListener(event: 'dom-ready', listener: (event: Event) => void): this; + removeListener(event: 'dom-ready', listener: (event: Event) => void): this; /** * Emitted when a result is available for [webContents.findInPage] request. */ - on(event: 'found-in-page', listener: (event?: Event, - result?: Result) => void): this; - once(event: 'found-in-page', listener: (event?: Event, - result?: Result) => void): this; - addListener(event: 'found-in-page', listener: (event?: Event, - result?: Result) => void): this; - removeListener(event: 'found-in-page', listener: (event?: Event, - result?: Result) => void): this; + on(event: 'found-in-page', listener: (event: Event, + result: Result) => void): this; + once(event: 'found-in-page', listener: (event: Event, + result: Result) => void): this; + addListener(event: 'found-in-page', listener: (event: Event, + result: Result) => void): this; + removeListener(event: 'found-in-page', listener: (event: Event, + result: Result) => void): this; /** * Emitted when webContents wants to do basic auth. The usage is the same with the * login event of app. */ - on(event: 'login', listener: (event?: Event, - request?: Request, - authInfo?: AuthInfo, - callback?: (username?: string, password?: string) => void) => void): this; - once(event: 'login', listener: (event?: Event, - request?: Request, - authInfo?: AuthInfo, - callback?: (username?: string, password?: string) => void) => void): this; - addListener(event: 'login', listener: (event?: Event, - request?: Request, - authInfo?: AuthInfo, - callback?: (username?: string, password?: string) => void) => void): this; - removeListener(event: 'login', listener: (event?: Event, - request?: Request, - authInfo?: AuthInfo, - callback?: (username?: string, password?: string) => void) => void): this; + on(event: 'login', listener: (event: Event, + request: Request, + authInfo: AuthInfo, + callback: (username: string, password: string) => void) => void): this; + once(event: 'login', listener: (event: Event, + request: Request, + authInfo: AuthInfo, + callback: (username: string, password: string) => void) => void): this; + addListener(event: 'login', listener: (event: Event, + request: Request, + authInfo: AuthInfo, + callback: (username: string, password: string) => void) => void): this; + removeListener(event: 'login', listener: (event: Event, + request: Request, + authInfo: AuthInfo, + callback: (username: string, password: string) => void) => void): this; /** * Emitted when media is paused or done playing. */ @@ -4369,140 +4375,140 @@ declare namespace Electron { * BrowserWindow instance, failing to do so may result in unexpected behavior. For * example: */ - on(event: 'new-window', listener: (event?: Event, - url?: string, - frameName?: string, + on(event: 'new-window', listener: (event: Event, + url: string, + frameName: string, /** * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, * `save-to-disk` and `other`. */ - disposition?: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), + disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), /** * The options which will be used for creating the new `BrowserWindow`. */ - options?: any, + options: any, /** * The non-standard features (features not handled by Chromium or Electron) given * to `window.open()`. */ - additionalFeatures?: string[]) => void): this; - once(event: 'new-window', listener: (event?: Event, - url?: string, - frameName?: string, + additionalFeatures: string[]) => void): this; + once(event: 'new-window', listener: (event: Event, + url: string, + frameName: string, /** * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, * `save-to-disk` and `other`. */ - disposition?: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), + disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), /** * The options which will be used for creating the new `BrowserWindow`. */ - options?: any, + options: any, /** * The non-standard features (features not handled by Chromium or Electron) given * to `window.open()`. */ - additionalFeatures?: string[]) => void): this; - addListener(event: 'new-window', listener: (event?: Event, - url?: string, - frameName?: string, + additionalFeatures: string[]) => void): this; + addListener(event: 'new-window', listener: (event: Event, + url: string, + frameName: string, /** * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, * `save-to-disk` and `other`. */ - disposition?: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), + disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), /** * The options which will be used for creating the new `BrowserWindow`. */ - options?: any, + options: any, /** * The non-standard features (features not handled by Chromium or Electron) given * to `window.open()`. */ - additionalFeatures?: string[]) => void): this; - removeListener(event: 'new-window', listener: (event?: Event, - url?: string, - frameName?: string, + additionalFeatures: string[]) => void): this; + removeListener(event: 'new-window', listener: (event: Event, + url: string, + frameName: string, /** * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, * `save-to-disk` and `other`. */ - disposition?: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), + disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), /** * The options which will be used for creating the new `BrowserWindow`. */ - options?: any, + options: any, /** * The non-standard features (features not handled by Chromium or Electron) given * to `window.open()`. */ - additionalFeatures?: string[]) => void): this; + additionalFeatures: string[]) => void): this; /** * Emitted when page receives favicon urls. */ - on(event: 'page-favicon-updated', listener: (event?: Event, + on(event: 'page-favicon-updated', listener: (event: Event, /** * Array of URLs */ - favicons?: string[]) => void): this; - once(event: 'page-favicon-updated', listener: (event?: Event, + favicons: string[]) => void): this; + once(event: 'page-favicon-updated', listener: (event: Event, /** * Array of URLs */ - favicons?: string[]) => void): this; - addListener(event: 'page-favicon-updated', listener: (event?: Event, + favicons: string[]) => void): this; + addListener(event: 'page-favicon-updated', listener: (event: Event, /** * Array of URLs */ - favicons?: string[]) => void): this; - removeListener(event: 'page-favicon-updated', listener: (event?: Event, + favicons: string[]) => void): this; + removeListener(event: 'page-favicon-updated', listener: (event: Event, /** * Array of URLs */ - favicons?: string[]) => void): this; + favicons: string[]) => void): this; /** * Emitted when a new frame is generated. Only the dirty area is passed in the * buffer. */ - on(event: 'paint', listener: (event?: Event, - dirtyRect?: Rectangle, + on(event: 'paint', listener: (event: Event, + dirtyRect: Rectangle, /** * The image data of the whole frame. */ - image?: NativeImage) => void): this; - once(event: 'paint', listener: (event?: Event, - dirtyRect?: Rectangle, + image: NativeImage) => void): this; + once(event: 'paint', listener: (event: Event, + dirtyRect: Rectangle, /** * The image data of the whole frame. */ - image?: NativeImage) => void): this; - addListener(event: 'paint', listener: (event?: Event, - dirtyRect?: Rectangle, + image: NativeImage) => void): this; + addListener(event: 'paint', listener: (event: Event, + dirtyRect: Rectangle, /** * The image data of the whole frame. */ - image?: NativeImage) => void): this; - removeListener(event: 'paint', listener: (event?: Event, - dirtyRect?: Rectangle, + image: NativeImage) => void): this; + removeListener(event: 'paint', listener: (event: Event, + dirtyRect: Rectangle, /** * The image data of the whole frame. */ - image?: NativeImage) => void): this; + image: NativeImage) => void): this; /** * Emitted when a plugin process has crashed. */ - on(event: 'plugin-crashed', listener: (event?: Event, - name?: string, - version?: string) => void): this; - once(event: 'plugin-crashed', listener: (event?: Event, - name?: string, - version?: string) => void): this; - addListener(event: 'plugin-crashed', listener: (event?: Event, - name?: string, - version?: string) => void): this; - removeListener(event: 'plugin-crashed', listener: (event?: Event, - name?: string, - version?: string) => void): this; + on(event: 'plugin-crashed', listener: (event: Event, + name: string, + version: string) => void): this; + once(event: 'plugin-crashed', listener: (event: Event, + name: string, + version: string) => void): this; + addListener(event: 'plugin-crashed', listener: (event: Event, + name: string, + version: string) => void): this; + removeListener(event: 'plugin-crashed', listener: (event: Event, + name: string, + version: string) => void): this; /** * Emitted when bluetooth device needs to be selected on call to * navigator.bluetooth.requestDevice. To use navigator.bluetooth api webBluetooth @@ -4510,49 +4516,49 @@ declare namespace Electron { * device will be selected. callback should be called with deviceId to be selected, * passing empty string to callback will cancel the request. */ - on(event: 'select-bluetooth-device', listener: (event?: Event, - devices?: BluetoothDevice[], - callback?: (deviceId?: string) => void) => void): this; - once(event: 'select-bluetooth-device', listener: (event?: Event, - devices?: BluetoothDevice[], - callback?: (deviceId?: string) => void) => void): this; - addListener(event: 'select-bluetooth-device', listener: (event?: Event, - devices?: BluetoothDevice[], - callback?: (deviceId?: string) => void) => void): this; - removeListener(event: 'select-bluetooth-device', listener: (event?: Event, - devices?: BluetoothDevice[], - callback?: (deviceId?: string) => void) => void): this; + on(event: 'select-bluetooth-device', listener: (event: Event, + devices: BluetoothDevice[], + callback: (deviceId: string) => void) => void): this; + once(event: 'select-bluetooth-device', listener: (event: Event, + devices: BluetoothDevice[], + callback: (deviceId: string) => void) => void): this; + addListener(event: 'select-bluetooth-device', listener: (event: Event, + devices: BluetoothDevice[], + callback: (deviceId: string) => void) => void): this; + removeListener(event: 'select-bluetooth-device', listener: (event: Event, + devices: BluetoothDevice[], + callback: (deviceId: string) => void) => void): this; /** * Emitted when a client certificate is requested. The usage is the same with the * select-client-certificate event of app. */ - on(event: 'select-client-certificate', listener: (event?: Event, - url?: string, - certificateList?: Certificate[], - callback?: (certificate?: Certificate) => void) => void): this; - once(event: 'select-client-certificate', listener: (event?: Event, - url?: string, - certificateList?: Certificate[], - callback?: (certificate?: Certificate) => void) => void): this; - addListener(event: 'select-client-certificate', listener: (event?: Event, - url?: string, - certificateList?: Certificate[], - callback?: (certificate?: Certificate) => void) => void): this; - removeListener(event: 'select-client-certificate', listener: (event?: Event, - url?: string, - certificateList?: Certificate[], - callback?: (certificate?: Certificate) => void) => void): this; + on(event: 'select-client-certificate', listener: (event: Event, + url: string, + certificateList: Certificate[], + callback: (certificate: Certificate) => void) => void): this; + once(event: 'select-client-certificate', listener: (event: Event, + url: string, + certificateList: Certificate[], + callback: (certificate: Certificate) => void) => void): this; + addListener(event: 'select-client-certificate', listener: (event: Event, + url: string, + certificateList: Certificate[], + callback: (certificate: Certificate) => void) => void): this; + removeListener(event: 'select-client-certificate', listener: (event: Event, + url: string, + certificateList: Certificate[], + callback: (certificate: Certificate) => void) => void): this; /** * Emitted when mouse moves over a link or the keyboard moves the focus to a link. */ - on(event: 'update-target-url', listener: (event?: Event, - url?: string) => void): this; - once(event: 'update-target-url', listener: (event?: Event, - url?: string) => void): this; - addListener(event: 'update-target-url', listener: (event?: Event, - url?: string) => void): this; - removeListener(event: 'update-target-url', listener: (event?: Event, - url?: string) => void): this; + on(event: 'update-target-url', listener: (event: Event, + url: string) => void): this; + once(event: 'update-target-url', listener: (event: Event, + url: string) => void): this; + addListener(event: 'update-target-url', listener: (event: Event, + url: string) => void): this; + removeListener(event: 'update-target-url', listener: (event: Event, + url: string) => void): this; /** * Emitted when a 's web contents is being attached to this web contents. * Calling event.preventDefault() will destroy the guest page. This event can be @@ -4560,50 +4566,50 @@ declare namespace Electron { * loaded, and provides the ability to set settings that can't be set via * attributes. */ - on(event: 'will-attach-webview', listener: (event?: Event, + on(event: 'will-attach-webview', listener: (event: Event, /** * The web preferences that will be used by the guest page. This object can be * modified to adjust the preferences for the guest page. */ - webPreferences?: any, + webPreferences: any, /** * The other `` parameters such as the `src` URL. This object can be * modified to adjust the parameters of the guest page. */ - params?: any) => void): this; - once(event: 'will-attach-webview', listener: (event?: Event, + params: any) => void): this; + once(event: 'will-attach-webview', listener: (event: Event, /** * The web preferences that will be used by the guest page. This object can be * modified to adjust the preferences for the guest page. */ - webPreferences?: any, + webPreferences: any, /** * The other `` parameters such as the `src` URL. This object can be * modified to adjust the parameters of the guest page. */ - params?: any) => void): this; - addListener(event: 'will-attach-webview', listener: (event?: Event, + params: any) => void): this; + addListener(event: 'will-attach-webview', listener: (event: Event, /** * The web preferences that will be used by the guest page. This object can be * modified to adjust the preferences for the guest page. */ - webPreferences?: any, + webPreferences: any, /** * The other `` parameters such as the `src` URL. This object can be * modified to adjust the parameters of the guest page. */ - params?: any) => void): this; - removeListener(event: 'will-attach-webview', listener: (event?: Event, + params: any) => void): this; + removeListener(event: 'will-attach-webview', listener: (event: Event, /** * The web preferences that will be used by the guest page. This object can be * modified to adjust the preferences for the guest page. */ - webPreferences?: any, + webPreferences: any, /** * The other `` parameters such as the `src` URL. This object can be * modified to adjust the parameters of the guest page. */ - params?: any) => void): this; + params: any) => void): this; /** * Emitted when a user or the page wants to start navigation. It can happen when * the window.location object is changed or a user clicks a link in the page. This @@ -4613,14 +4619,14 @@ declare namespace Electron { * window.location.hash. Use did-navigate-in-page event for this purpose. Calling * event.preventDefault() will prevent the navigation. */ - on(event: 'will-navigate', listener: (event?: Event, - url?: string) => void): this; - once(event: 'will-navigate', listener: (event?: Event, - url?: string) => void): this; - addListener(event: 'will-navigate', listener: (event?: Event, - url?: string) => void): this; - removeListener(event: 'will-navigate', listener: (event?: Event, - url?: string) => void): this; + on(event: 'will-navigate', listener: (event: Event, + url: string) => void): this; + once(event: 'will-navigate', listener: (event: Event, + url: string) => void): this; + addListener(event: 'will-navigate', listener: (event: Event, + url: string) => void): this; + removeListener(event: 'will-navigate', listener: (event: Event, + url: string) => void): this; /** * Adds the specified path to DevTools workspace. Must be used after DevTools * creation: @@ -4638,7 +4644,7 @@ declare namespace Electron { * set to true, frameBuffer will only contain the repainted area. onlyDirty * defaults to false. */ - beginFrameSubscription(callback: (frameBuffer?: Buffer, dirtyRect?: Rectangle) => void): void; + beginFrameSubscription(callback: (frameBuffer: Buffer, dirtyRect: Rectangle) => void): void; /** * Begin subscribing for presentation events and captured frames, the callback will * be called with callback(frameBuffer, dirtyRect) when there is a presentation @@ -4651,7 +4657,7 @@ declare namespace Electron { * set to true, frameBuffer will only contain the repainted area. onlyDirty * defaults to false. */ - beginFrameSubscription(onlyDirty: boolean, callback: (frameBuffer?: Buffer, dirtyRect?: Rectangle) => void): void; + beginFrameSubscription(onlyDirty: boolean, callback: (frameBuffer: Buffer, dirtyRect: Rectangle) => void): void; canGoBack(): boolean; canGoForward(): boolean; canGoToOffset(offset: number): boolean; @@ -4660,13 +4666,13 @@ declare namespace Electron { * called with callback(image). The image is an instance of NativeImage that stores * data of the snapshot. Omitting rect will capture the whole visible page. */ - capturePage(rect: Rectangle, callback: (image?: NativeImage) => void): void; + capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; /** * Captures a snapshot of the page within rect. Upon completion callback will be * called with callback(image). The image is an instance of NativeImage that stores * data of the snapshot. Omitting rect will capture the whole visible page. */ - capturePage(callback: (image?: NativeImage) => void): void; + capturePage(callback: (image: NativeImage) => void): void; /** * Clears the navigation history. */ @@ -4716,7 +4722,7 @@ declare namespace Electron { * We recommend that you use the returned Promise to handle code that results in a * Promise. */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result?: any) => void): Promise; + executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise; /** * Starts a request to find all matches for the text in the web page and returns an * Integer representing the request id used for the request. The result of the @@ -4732,12 +4738,12 @@ declare namespace Electron { * Sends a request to get current zoom factor, the callback will be called with * callback(zoomFactor). */ - getZoomFactor(callback: (zoomFactor?: number) => void): void; + getZoomFactor(callback: (zoomFactor: number) => void): void; /** * Sends a request to get current zoom level, the callback will be called with * callback(zoomLevel). */ - getZoomLevel(callback: (zoomLevel?: number) => void): void; + getZoomLevel(callback: (zoomLevel: number) => void): void; /** * Makes the browser go back a web page. */ @@ -4758,7 +4764,7 @@ declare namespace Electron { * Checks if any ServiceWorker is registered and returns a boolean as response to * callback. */ - hasServiceWorker(callback: (hasWorker?: boolean) => void): void; + hasServiceWorker(callback: (hasWorker: boolean) => void): void; /** * Injects CSS into the current web page. */ @@ -4826,7 +4832,7 @@ declare namespace Electron { * options will be regarded as: Use page-break-before: always; CSS style to force * to print to a new page. An example of webContents.printToPDF: */ - printToPDF(options: PrintToPDFOptions, callback: (error?: Error, data?: Buffer) => void): void; + printToPDF(options: PrintToPDFOptions, callback: (error: Error, data: Buffer) => void): void; /** * Executes the editing command redo in web page. */ @@ -4851,7 +4857,7 @@ declare namespace Electron { * Executes the editing command replaceMisspelling in web page. */ replaceMisspelling(text: string): void; - savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML', callback: (error?: Error) => void): boolean; + savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML', callback: (error: Error) => void): boolean; /** * Executes the editing command selectAll in web page. */ @@ -4956,7 +4962,7 @@ declare namespace Electron { * callback when the JS promise is fulfilled or false when the JS promise is * rejected. */ - unregisterServiceWorker(callback: (success?: boolean) => void): void; + unregisterServiceWorker(callback: (success: boolean) => void): void; /** * Executes the editing command unselect in web page. */ @@ -4986,7 +4992,7 @@ declare namespace Electron { * requestFullScreen can only be invoked by a gesture from the user. Setting * userGesture to true will remove this limitation. */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result?: any) => void): Promise; + executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise; /** * Returns an object describing usage information of Blink's internal memory * caches. This will generate: @@ -5056,13 +5062,13 @@ declare namespace Electron { * The listener will be called with listener(details) when a server initiated * redirect is about to occur. */ - onBeforeRedirect(filter: OnBeforeRedirectFilter, listener: (details?: OnBeforeRedirectDetails) => void): void; + onBeforeRedirect(filter: OnBeforeRedirectFilter, listener: (details: OnBeforeRedirectDetails) => void): void; /** * The listener will be called with listener(details, callback) when a request is * about to occur. The uploadData is an array of UploadData objects. The callback * has to be called with an response object. */ - onBeforeRequest(filter: OnBeforeRequestFilter, listener: (details?: OnBeforeRequestDetails, callback?: (response?: Response) => void) => void): void; + onBeforeRequest(filter: OnBeforeRequestFilter, listener: (details: OnBeforeRequestDetails, callback: (response: Response) => void) => void): void; /** * The listener will be called with listener(details, callback) before sending an * HTTP request, once the request headers are available. This may occur after a TCP @@ -5073,11 +5079,11 @@ declare namespace Electron { /** * The listener will be called with listener(details) when a request is completed. */ - onCompleted(filter: OnCompletedFilter, listener: (details?: OnCompletedDetails) => void): void; + onCompleted(filter: OnCompletedFilter, listener: (details: OnCompletedDetails) => void): void; /** * The listener will be called with listener(details) when an error occurs. */ - onErrorOccurred(filter: OnErrorOccurredFilter, listener: (details?: OnErrorOccurredDetails) => void): void; + onErrorOccurred(filter: OnErrorOccurredFilter, listener: (details: OnErrorOccurredDetails) => void): void; /** * The listener will be called with listener(details, callback) when HTTP response * headers of a request have been received. The callback has to be called with an @@ -5089,13 +5095,13 @@ declare namespace Electron { * response body is received. For HTTP requests, this means that the status line * and response headers are available. */ - onResponseStarted(filter: OnResponseStartedFilter, listener: (details?: OnResponseStartedDetails) => void): void; + onResponseStarted(filter: OnResponseStartedFilter, listener: (details: OnResponseStartedDetails) => void): void; /** * The listener will be called with listener(details) just before a request is * going to be sent to the server, modifications of previous onBeforeSendHeaders * response are visible by the time this listener is fired. */ - onSendHeaders(filter: OnSendHeadersFilter, listener: (details?: OnSendHeadersDetails) => void): void; + onSendHeaders(filter: OnSendHeadersFilter, listener: (details: OnSendHeadersDetails) => void): void; } interface WebviewTag extends HTMLElement { @@ -5293,12 +5299,12 @@ declare namespace Electron { * Captures a snapshot of the webview's page. Same as * webContents.capturePage([rect, ]callback). */ - capturePage(callback: (image?: NativeImage) => void): void; + capturePage(callback: (image: NativeImage) => void): void; /** * Captures a snapshot of the webview's page. Same as * webContents.capturePage([rect, ]callback). */ - capturePage(rect: Rectangle, callback: (image?: NativeImage) => void): void; + capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; /** * Clears the navigation history. */ @@ -5324,7 +5330,7 @@ declare namespace Electron { * context in the page. HTML APIs like requestFullScreen, which require user * action, can take advantage of this option for automation. */ - executeJavaScript(code: string, userGesture: boolean, callback?: (result?: any) => void): void; + executeJavaScript(code: string, userGesture: boolean, callback?: (result: any) => void): void; /** * Starts a request to find all matches for the text in the web page and returns an * Integer representing the request id used for the request. The result of the @@ -5398,7 +5404,7 @@ declare namespace Electron { * Prints webview's web page as PDF, Same as webContents.printToPDF(options, * callback). */ - printToPDF(options: PrintToPDFOptions, callback: (error?: Error, data?: Buffer) => void): void; + printToPDF(options: PrintToPDFOptions, callback: (error: Error, data: Buffer) => void): void; /** * Executes editing command redo in page. */ @@ -5605,13 +5611,13 @@ declare namespace Electron { /** * The scale factor to add the image representation for. */ - scaleFactor?: number; + scaleFactor: number; /** - * Defaults to 0. Required if a bitmap buffer is specified as . + * Defaults to 0. Required if a bitmap buffer is specified as buffer. */ width?: number; /** - * Defaults to 0. Required if a bitmap buffer is specified as . + * Defaults to 0. Required if a bitmap buffer is specified as buffer. */ height?: number; /** @@ -5634,7 +5640,8 @@ declare namespace Electron { */ appIconPath?: string; /** - * Index of the icon in . Ignored when is not set. Default is . + * Index of the icon in appIconPath. Ignored when appIconPath is not set. Default + * is 0. */ appIconIndex?: number; /** @@ -5648,22 +5655,24 @@ declare namespace Electron { } interface AuthInfo { - isProxy?: boolean; - scheme?: string; - host?: string; - port?: number; - realm?: string; + isProxy: boolean; + scheme: string; + host: string; + port: number; + realm: string; } interface AutoResizeOptions { /** - * default. + * If true, the view's width will grow and shrink together with the window. false + * by default. */ - false?: by; + width: boolean; /** - * default. + * If true, the view's height will grow and shrink together with the window. false + * by default. */ - false?: by; + height: boolean; } interface BitmapOptions { @@ -5682,11 +5691,11 @@ declare namespace Electron { interface BrowserWindowConstructorOptions { /** - * Window's width in pixels. Default is . + * Window's width in pixels. Default is 800. */ width?: number; /** - * Window's height in pixels. Default is . + * Window's height in pixels. Default is 600. */ height?: number; /** @@ -5700,8 +5709,9 @@ declare namespace Electron { */ y?: number; /** - * The and would be used as web page's size, which means the actual window's size - * will include window frame's size and be slightly larger. Default is . + * The width and height would be used as web page's size, which means the actual + * window's size will include window frame's size and be slightly larger. Default + * is false. */ useContentSize?: boolean; /** @@ -5709,11 +5719,11 @@ declare namespace Electron { */ center?: boolean; /** - * Window's minimum width. Default is . + * Window's minimum width. Default is 0. */ minWidth?: number; /** - * Window's minimum height. Default is . + * Window's minimum height. Default is 0. */ minHeight?: number; /** @@ -5725,114 +5735,118 @@ declare namespace Electron { */ maxHeight?: number; /** - * Whether window is resizable. Default is . + * Whether window is resizable. Default is true. */ resizable?: boolean; /** - * Whether window is movable. This is not implemented on Linux. Default is . + * Whether window is movable. This is not implemented on Linux. Default is true. */ movable?: boolean; /** - * Whether window is minimizable. This is not implemented on Linux. Default is . + * Whether window is minimizable. This is not implemented on Linux. Default is + * true. */ minimizable?: boolean; /** - * Whether window is maximizable. This is not implemented on Linux. Default is . + * Whether window is maximizable. This is not implemented on Linux. Default is + * true. */ maximizable?: boolean; /** - * Whether window is closable. This is not implemented on Linux. Default is . + * Whether window is closable. This is not implemented on Linux. Default is true. */ closable?: boolean; /** - * Whether the window can be focused. Default is . On Windows setting also implies - * setting . On Linux setting makes the window stop interacting with wm, so the - * window will always stay on top in all workspaces. + * Whether the window can be focused. Default is true. On Windows setting + * focusable: false also implies setting skipTaskbar: true. On Linux setting + * focusable: false makes the window stop interacting with wm, so the window will + * always stay on top in all workspaces. */ focusable?: boolean; /** - * Whether the window should always stay on top of other windows. Default is . + * Whether the window should always stay on top of other windows. Default is false. */ alwaysOnTop?: boolean; /** - * Whether the window should show in fullscreen. When explicitly set to the - * fullscreen button will be hidden or disabled on macOS. Default is . + * Whether the window should show in fullscreen. When explicitly set to false the + * fullscreen button will be hidden or disabled on macOS. Default is false. */ fullscreen?: boolean; /** * Whether the window can be put into fullscreen mode. On macOS, also whether the * maximize/zoom button should toggle full screen mode or maximize window. Default - * is . + * is true. */ fullscreenable?: boolean; /** - * Whether to show the window in taskbar. Default is . + * Whether to show the window in taskbar. Default is false. */ skipTaskbar?: boolean; /** - * The kiosk mode. Default is . + * The kiosk mode. Default is false. */ kiosk?: boolean; /** - * Default window title. Default is . + * Default window title. Default is "Electron". */ title?: string; /** - * The window icon. On Windows it is recommended to use icons to get best visual - * effects, you can also leave it undefined so the executable's icon will be used. + * The window icon. On Windows it is recommended to use ICO icons to get best + * visual effects, you can also leave it undefined so the executable's icon will be + * used. */ icon?: NativeImage | string; /** - * Whether window should be shown when created. Default is . + * Whether window should be shown when created. Default is true. */ show?: boolean; /** - * Specify to create a . Default is . + * Specify false to create a . Default is true. */ frame?: boolean; /** - * Specify parent window. Default is . + * Specify parent window. Default is null. */ parent?: BrowserWindow; /** * Whether this is a modal window. This only works when the window is a child - * window. Default is . + * window. Default is false. */ modal?: boolean; /** * Whether the web view accepts a single mouse-down event that simultaneously - * activates the window. Default is . + * activates the window. Default is false. */ acceptFirstMouse?: boolean; /** - * Whether to hide cursor when typing. Default is . + * Whether to hide cursor when typing. Default is false. */ disableAutoHideCursor?: boolean; /** - * Auto hide the menu bar unless the key is pressed. Default is . + * Auto hide the menu bar unless the Alt key is pressed. Default is false. */ autoHideMenuBar?: boolean; /** - * Enable the window to be resized larger than screen. Default is . + * Enable the window to be resized larger than screen. Default is false. */ enableLargerThanScreen?: boolean; /** - * Window's background color as Hexadecimal value, like or or (alpha is supported). - * Default is (white). + * Window's background color as Hexadecimal value, like #66CD00 or #FFF or + * #80FFFFFF (alpha is supported). Default is #FFF (white). */ backgroundColor?: string; /** * Whether window should have a shadow. This is only implemented on macOS. Default - * is . + * is true. */ hasShadow?: boolean; /** * Forces using dark theme for the window, only works on some GTK+3 desktop - * environments. Default is . + * environments. Default is false. */ darkTheme?: boolean; /** - * Makes the window . Default is . + * Makes the window . Default is false. */ transparent?: boolean; /** @@ -5840,25 +5854,27 @@ declare namespace Electron { */ type?: string; /** - * The style of window title bar. Default is . Possible values are: + * The style of window title bar. Default is default. Possible values are: */ titleBarStyle?: ('default' | 'hidden' | 'hidden-inset'); /** - * Use style for frameless windows on Windows, which adds standard window frame. - * Setting it to will remove window shadow and window animations. Default is . + * Use WS_THICKFRAME style for frameless windows on Windows, which adds standard + * window frame. Setting it to false will remove window shadow and window + * animations. Default is true. */ thickFrame?: boolean; /** - * Add a type of vibrancy effect to the window, only on macOS. Can be , , , , , , , - * , or . + * Add a type of vibrancy effect to the window, only on macOS. Can be + * appearance-based, light, dark, titlebar, selection, menu, popover, sidebar, + * medium-light or ultra-dark. */ vibrancy?: ('appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark'); /** * Controls the behavior on macOS when option-clicking the green stoplight button - * on the toolbar or by clicking the Window > Zoom menu item. If , the window will - * grow to the preferred width of the web page when zoomed, will cause it to zoom - * to the width of the screen. This will also affect the behavior when calling - * directly. Default is . + * on the toolbar or by clicking the Window > Zoom menu item. If true, the window + * will grow to the preferred width of the web page when zoomed, false will cause + * it to zoom to the width of the screen. This will also affect the behavior when + * calling maximize() directly. Default is false. */ zoomToPageWidth?: boolean; /** @@ -5876,35 +5892,36 @@ declare namespace Electron { /** * The certificate to trust/import. */ - certificate?: Certificate; + certificate: Certificate; /** * The message to display to the user. */ - message?: string; + message: string; } interface CertificateVerifyProcRequest { - hostname?: string; - certificate?: Certificate; + hostname: string; + certificate: Certificate; /** * Verification result from chromium. */ - error?: string; + error: string; } interface ClearStorageDataOptions { /** - * Should follow ’s representation . + * Should follow window.location.origin’s representation scheme://host:port. */ - origin?: string; + origin: string; /** - * The types of storages to clear, can contain: , , , , , , , + * The types of storages to clear, can contain: appcache, cookies, filesystem, + * indexdb, localstorage, shadercache, websql, serviceworkers */ - storages?: string[]; + storages: string[]; /** - * The types of quotas to clear, can contain: , , . + * The types of quotas to clear, can contain: temporary, persistent, syncable. */ - quotas?: string[]; + quotas: string[]; } interface CommandLine { @@ -5913,113 +5930,115 @@ declare namespace Electron { * will not affect process.argv, and is mainly used by developers to control some * low-level Chromium behaviors. */ - appendSwitch?: (the_switch: string, value?: string) => void; + appendSwitch: (the_switch: string, value?: string) => void; /** * Append an argument to Chromium's command line. The argument will be quoted * correctly. Note: This will not affect process.argv. */ - appendArgument?: (value: string) => void; + appendArgument: (value: string) => void; } interface Config { /** * The URL associated with the PAC file. */ - pacScript?: string; + pacScript: string; /** * Rules indicating which proxies to use. */ - proxyRules?: string; + proxyRules: string; /** * Rules indicating which URLs should bypass the proxy settings. */ - proxyBypassRules?: string; + proxyBypassRules: string; } interface ConsoleMessageEvent extends Event { - level?: number; - message?: string; - line?: number; - sourceId?: string; + level: number; + message: string; + line: number; + sourceId: string; } interface ContextMenuParams { /** * x coordinate */ - x?: number; + x: number; /** * y coordinate */ - y?: number; + y: number; /** * URL of the link that encloses the node the context menu was invoked on. */ - linkURL?: string; + linkURL: string; /** * Text associated with the link. May be an empty string if the contents of the * link are an image. */ - linkText?: string; + linkText: string; /** * URL of the top level page that the context menu was invoked on. */ - pageURL?: string; + pageURL: string; /** * URL of the subframe that the context menu was invoked on. */ - frameURL?: string; + frameURL: string; /** * Source URL for the element that the context menu was invoked on. Elements with * source URLs are images, audio and video. */ - srcURL?: string; + srcURL: string; /** - * Type of the node the context menu was invoked on. Can be , , , , , or . + * Type of the node the context menu was invoked on. Can be none, image, audio, + * video, canvas, file or plugin. */ - mediaType?: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin'); + mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin'); /** * Whether the context menu was invoked on an image which has non-empty contents. */ - hasImageContents?: boolean; + hasImageContents: boolean; /** * Whether the context is editable. */ - isEditable?: boolean; + isEditable: boolean; /** * Text of the selection that the context menu was invoked on. */ - selectionText?: string; + selectionText: string; /** * Title or alt text of the selection that the context was invoked on. */ - titleText?: string; + titleText: string; /** * The misspelled word under the cursor, if any. */ - misspelledWord?: string; + misspelledWord: string; /** * The character encoding of the frame on which the menu was invoked. */ - frameCharset?: string; + frameCharset: string; /** * If the context menu was invoked on an input field, the type of that field. - * Possible values are , , , . + * Possible values are none, plainText, password, other. */ - inputFieldType?: string; + inputFieldType: string; /** - * Input source that invoked the context menu. Can be , , , , . + * Input source that invoked the context menu. Can be none, mouse, keyboard, touch, + * touchMenu. */ - menuSourceType?: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu'); + menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu'); /** * The flags for the media element the context menu was invoked on. */ - mediaFlags?: MediaFlags; + mediaFlags: MediaFlags; /** * These flags indicate whether the renderer believes it is able to perform the * corresponding action. */ - editFlags?: EditFlags; + editFlags: EditFlags; } interface CrashReporterStartOptions { @@ -6027,17 +6046,17 @@ declare namespace Electron { /** * URL that crash reports will be sent to as POST. */ - submitURL?: string; + submitURL: string; /** - * Defaults to . + * Defaults to app.getName(). */ productName?: string; /** - * Whether crash reports should be sent to the server Default is . + * Whether crash reports should be sent to the server Default is true. */ uploadToServer?: boolean; /** - * Default is . + * Default is false. */ ignoreSystemCrashHandler?: boolean; /** @@ -6066,28 +6085,28 @@ declare namespace Electron { /** * Absolute path of the download. */ - path?: string; + path: string; /** * Complete URL chain for the download. */ - urlChain?: string[]; + urlChain: string[]; mimeType?: string; /** * Start range for the download. */ - offset?: number; + offset: number; /** * Total length of the download. */ - length?: number; + length: number; /** * Last-Modified header value. */ - lastModified?: string; + lastModified: string; /** * ETag header value. */ - eTag?: string; + eTag: string; /** * Time when download was started in number of seconds since UNIX epoch. */ @@ -6100,7 +6119,7 @@ declare namespace Electron { image?: NativeImage; rtf?: string; /** - * The title of the url at . + * The title of the url at text. */ bookmark?: string; } @@ -6109,7 +6128,7 @@ declare namespace Electron { /** * The url to associate the cookie with. */ - url?: string; + url: string; /** * The name of the cookie. Empty by default if omitted. */ @@ -6146,44 +6165,44 @@ declare namespace Electron { } interface DidChangeThemeColorEvent extends Event { - themeColor?: string; + themeColor: string; } interface DidFailLoadEvent extends Event { - errorCode?: number; - errorDescription?: string; - validatedURL?: string; - isMainFrame?: boolean; + errorCode: number; + errorDescription: string; + validatedURL: string; + isMainFrame: boolean; } interface DidFrameFinishLoadEvent extends Event { - isMainFrame?: boolean; + isMainFrame: boolean; } interface DidGetRedirectRequestEvent extends Event { - oldURL?: string; - newURL?: string; - isMainFrame?: boolean; + oldURL: string; + newURL: string; + isMainFrame: boolean; } interface DidGetResponseDetailsEvent extends Event { - status?: boolean; - newURL?: string; - originalURL?: string; - httpResponseCode?: number; - requestMethod?: string; - referrer?: string; - headers?: Headers; - resourceType?: string; + status: boolean; + newURL: string; + originalURL: string; + httpResponseCode: number; + requestMethod: string; + referrer: string; + headers: Headers; + resourceType: string; } interface DidNavigateEvent extends Event { - url?: string; + url: string; } interface DidNavigateInPageEvent extends Event { - isMainFrame?: boolean; - url?: string; + isMainFrame: boolean; + url: string; } interface DisplayBalloonOptions { @@ -6199,37 +6218,37 @@ declare namespace Electron { * dock icon will bounce for one second. However, the request remains active until * either the application becomes active or the request is canceled. */ - bounce?: (type?: 'critical' | 'informational') => number; + bounce: (type?: 'critical' | 'informational') => number; /** * Cancel the bounce of id. */ - cancelBounce?: (id: number) => void; + cancelBounce: (id: number) => void; /** * Bounces the Downloads stack if the filePath is inside the Downloads folder. */ - downloadFinished?: (filePath: string) => void; + downloadFinished: (filePath: string) => void; /** * Sets the string to be displayed in the dock’s badging area. */ - setBadge?: (text: string) => void; - getBadge?: () => string; + setBadge: (text: string) => void; + getBadge: () => string; /** * Hides the dock icon. */ - hide?: () => void; + hide: () => void; /** * Shows the dock icon. */ - show?: () => void; - isVisible?: () => boolean; + show: () => void; + isVisible: () => boolean; /** * Sets the application's dock menu. */ - setMenu?: (menu: Menu) => void; + setMenu: (menu: Menu) => void; /** * Sets the image associated with this dock icon. */ - setIcon?: (image: NativeImage | string) => void; + setIcon: (image: NativeImage | string) => void; } interface EnableNetworkEmulationOptions { @@ -6252,13 +6271,13 @@ declare namespace Electron { } interface FileIconOptions { - size?: ('small' | 'normal' | 'large'); + size: ('small' | 'normal' | 'large'); } interface Filter { /** - * Retrieves cookies which are associated with . Empty implies retrieving cookies - * of all urls. + * Retrieves cookies which are associated with url. Empty implies retrieving + * cookies of all urls. */ url?: string; /** @@ -6266,11 +6285,11 @@ declare namespace Electron { */ name?: string; /** - * Retrieves cookies whose domains match or are subdomains of + * Retrieves cookies whose domains match or are subdomains of domains */ domain?: string; /** - * Retrieves cookies whose path matches . + * Retrieves cookies whose path matches path. */ path?: string; /** @@ -6285,128 +6304,128 @@ declare namespace Electron { interface FindInPageOptions { /** - * Whether to search forward or backward, defaults to . + * Whether to search forward or backward, defaults to true. */ forward?: boolean; /** - * Whether the operation is first request or a follow up, defaults to . + * Whether the operation is first request or a follow up, defaults to false. */ findNext?: boolean; /** - * Whether search should be case-sensitive, defaults to . + * Whether search should be case-sensitive, defaults to false. */ matchCase?: boolean; /** - * Whether to look only at the start of words. defaults to . + * Whether to look only at the start of words. defaults to false. */ wordStart?: boolean; /** - * When combined with , accepts a match in the middle of a word if the match begins - * with an uppercase letter followed by a lowercase or non-letter. Accepts several - * other intra-word matches, defaults to . + * When combined with wordStart, accepts a match in the middle of a word if the + * match begins with an uppercase letter followed by a lowercase or non-letter. + * Accepts several other intra-word matches, defaults to false. */ medialCapitalAsWordStart?: boolean; } interface FoundInPageEvent extends Event { - result?: FoundInPageResult; + result: FoundInPageResult; } interface FromPartitionOptions { /** * Whether to enable cache. */ - cache?: boolean; + cache: boolean; } interface ImportCertificateOptions { /** * Path for the pkcs12 file. */ - certificate?: string; + certificate: string; /** * Passphrase for the certificate. */ - password?: string; + password: string; } interface Input { /** - * Either or + * Either keyUp or keyDown */ - type?: string; + type: string; /** * Equivalent to */ - key?: string; + key: string; /** * Equivalent to */ - code?: string; + code: string; /** * Equivalent to */ - isAutoRepeat?: boolean; + isAutoRepeat: boolean; /** * Equivalent to */ - shift?: boolean; + shift: boolean; /** * Equivalent to */ - control?: boolean; + control: boolean; /** * Equivalent to */ - alt?: boolean; + alt: boolean; /** * Equivalent to */ - meta?: boolean; + meta: boolean; } interface InterceptBufferProtocolRequest { - url?: string; - referrer?: string; - method?: string; - uploadData?: UploadData[]; + url: string; + referrer: string; + method: string; + uploadData: UploadData[]; } interface InterceptFileProtocolRequest { - url?: string; - referrer?: string; - method?: string; - uploadData?: UploadData[]; + url: string; + referrer: string; + method: string; + uploadData: UploadData[]; } interface InterceptHttpProtocolRequest { - url?: string; - referrer?: string; - method?: string; - uploadData?: UploadData[]; + url: string; + referrer: string; + method: string; + uploadData: UploadData[]; } interface InterceptStringProtocolRequest { - url?: string; - referrer?: string; - method?: string; - uploadData?: UploadData[]; + url: string; + referrer: string; + method: string; + uploadData: UploadData[]; } interface IpcMessageEvent extends Event { - channel?: string; - args?: any[]; + channel: string; + args: any[]; } interface Item { /** - * or Array The path(s) to the file(s) being dragged. + * or files Array The path(s) to the file(s) being dragged. */ - file?: string; + file: string; /** * The image must be non-empty on macOS. */ - icon?: NativeImage; + icon: NativeImage; } interface JumpListSettings { @@ -6414,19 +6433,19 @@ declare namespace Electron { * The minimum number of items that will be shown in the Jump List (for a more * detailed description of this value see the ). */ - minItems?: number; + minItems: number; /** - * Array of objects that correspond to items that the user has explicitly removed - * from custom categories in the Jump List. These items must not be re-added to the - * Jump List in the call to , Windows will not display any custom category that - * contains any of the removed items. + * Array of JumpListItem objects that correspond to items that the user has + * explicitly removed from custom categories in the Jump List. These items must not + * be re-added to the Jump List in the call to app.setJumpList(), Windows will not + * display any custom category that contains any of the removed items. */ - removedItems?: JumpListItem[]; + removedItems: JumpListItem[]; } interface LoadCommitEvent extends Event { - url?: string; - isMainFrame?: boolean; + url: string; + isMainFrame: boolean; } interface LoadURLOptions { @@ -6442,10 +6461,10 @@ declare namespace Electron { * Extra headers separated by "\n" */ extraHeaders?: string; - postData?: UploadRawData | UploadFile | UploadFileSystem | UploadBlob; + postData?: UploadRawData[] | UploadFile[] | UploadFileSystem[] | UploadBlob[]; /** * Base url (with trailing path separator) for files to be loaded by the data url. - * This is needed only if the specified is a data url and needs to load other + * This is needed only if the specified url is a data url and needs to load other * files. */ baseURLForDataURL?: string; @@ -6454,36 +6473,36 @@ declare namespace Electron { interface LoginItemSettings { options?: Options; /** - * if the app is set to open at login. + * true if the app is set to open at login. */ - openAtLogin?: boolean; + openAtLogin: boolean; /** - * if the app is set to open as hidden at login. This setting is only supported on - * macOS. + * true if the app is set to open as hidden at login. This setting is only + * supported on macOS. */ - openAsHidden?: boolean; + openAsHidden: boolean; /** - * if the app was opened at login automatically. This setting is only supported on - * macOS. + * true if the app was opened at login automatically. This setting is only + * supported on macOS. */ - wasOpenedAtLogin?: boolean; + wasOpenedAtLogin: boolean; /** - * if the app was opened as a hidden login item. This indicates that the app should - * not open any windows at startup. This setting is only supported on macOS. + * true if the app was opened as a hidden login item. This indicates that the app + * should not open any windows at startup. This setting is only supported on macOS. */ - wasOpenedAsHidden?: boolean; + wasOpenedAsHidden: boolean; /** - * if the app was opened as a login item that should restore the state from the - * previous session. This indicates that the app should restore the windows that - * were open the last time the app was closed. This setting is only supported on - * macOS. + * true if the app was opened as a login item that should restore the state from + * the previous session. This indicates that the app should restore the windows + * that were open the last time the app was closed. This setting is only supported + * on macOS. */ - restoreState?: boolean; + restoreState: boolean; } interface LoginItemSettingsOptions { /** - * The executable path to compare against. Defaults to . + * The executable path to compare against. Defaults to process.execPath. */ path?: string; /** @@ -6494,16 +6513,17 @@ declare namespace Electron { interface MenuItemConstructorOptions { /** - * Will be called with when the menu item is clicked. + * Will be called with click(menuItem, browserWindow, event) when the menu item is + * clicked. */ - click?: (menuItem?: MenuItem, browserWindow?: BrowserWindow, event?: Event) => void; + click?: (menuItem: MenuItem, browserWindow: BrowserWindow, event: Event) => void; /** - * Define the action of the menu item, when specified the property will be ignored. - * See . + * Define the action of the menu item, when specified the click property will be + * ignored. See . */ role?: string; /** - * Can be , , , or . + * Can be normal, separator, submenu, checkbox or radio. */ type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio'); label?: string; @@ -6519,12 +6539,13 @@ declare namespace Electron { */ visible?: boolean; /** - * Should only be specified for or type menu items. + * Should only be specified for checkbox or radio type menu items. */ checked?: boolean; /** - * Should be specified for type menu items. If is specified, the can be omitted. If - * the value is not a then it will be automatically converted to one using . + * Should be specified for submenu type menu items. If submenu is specified, the + * type: 'submenu' can be omitted. If the value is not a Menu then it will be + * automatically converted to one using Menu.buildFromTemplate. */ submenu?: MenuItemConstructorOptions[] | Menu; /** @@ -6541,8 +6562,9 @@ declare namespace Electron { interface MessageBoxOptions { /** - * Can be , , , or . On Windows, displays the same icon as , unless you set an icon - * using the option. On macOS, both and display the same warning icon. + * Can be "none", "info", "error", "question" or "warning". On Windows, "question" + * displays the same icon as "info", unless you set an icon using the "icon" + * option. On macOS, both "warning" and "error" display the same warning icon. */ type?: string; /** @@ -6562,74 +6584,75 @@ declare namespace Electron { /** * Content of the message box. */ - message?: string; + message: string; /** * Extra information of the message. */ detail?: string; /** * If provided, the message box will include a checkbox with the given label. The - * checkbox state can be inspected only when using . + * checkbox state can be inspected only when using callback. */ checkboxLabel?: string; /** - * Initial checked state of the checkbox. by default. + * Initial checked state of the checkbox. false by default. */ checkboxChecked?: boolean; icon?: NativeImage; /** - * The index of the button to be used to cancel the dialog, via the key. By default - * this is assigned to the first button with "cancel" or "no" as the label. If no - * such labeled buttons exist and this option is not set, will be used as the - * return value or callback response. This option is ignored on Windows. + * The index of the button to be used to cancel the dialog, via the Esc key. By + * default this is assigned to the first button with "cancel" or "no" as the label. + * If no such labeled buttons exist and this option is not set, 0 will be used as + * the return value or callback response. This option is ignored on Windows. */ cancelId?: number; /** - * On Windows Electron will try to figure out which one of the are common buttons - * (like "Cancel" or "Yes"), and show the others as command links in the dialog. - * This can make the dialog appear in the style of modern Windows apps. If you - * don't like this behavior, you can set to . + * On Windows Electron will try to figure out which one of the buttons are common + * buttons (like "Cancel" or "Yes"), and show the others as command links in the + * dialog. This can make the dialog appear in the style of modern Windows apps. If + * you don't like this behavior, you can set noLink to true. */ noLink?: boolean; /** - * Normalize the keyboard access keys across platforms. Default is . Enabling this - * assumes is used in the button labels for the placement of the keyboard shortcut - * access key and labels will be converted so they work correctly on each platform, - * characters are removed on macOS, converted to on Linux, and left untouched on - * Windows. For example, a button label of will be converted to on Linux and on - * macOS and can be selected via on Windows and Linux. + * Normalize the keyboard access keys across platforms. Default is false. Enabling + * this assumes & is used in the button labels for the placement of the keyboard + * shortcut access key and labels will be converted so they work correctly on each + * platform, & characters are removed on macOS, converted to _ on Linux, and left + * untouched on Windows. For example, a button label of Vie&w will be converted to + * Vie_w on Linux and View on macOS and can be selected via Alt-W on Windows and + * Linux. */ normalizeAccessKeys?: boolean; } interface NewWindowEvent extends Event { - url?: string; - frameName?: string; + url: string; + frameName: string; /** * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, * `save-to-disk` and `other`. */ - disposition?: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'); + disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'); /** * The options which should be used for creating the new `BrowserWindow`. */ - options?: Options; + options: Options; } interface OnBeforeRedirectDetails { - id?: string; - url?: string; - method?: string; - resourceType?: string; - timestamp?: number; - redirectURL?: string; - statusCode?: number; + id: string; + url: string; + method: string; + resourceType: string; + timestamp: number; + redirectURL: string; + statusCode: number; /** * The server IP address that the request was actually sent to. */ ip?: string; - fromCache?: boolean; - responseHeaders?: ResponseHeaders; + fromCache: boolean; + responseHeaders: ResponseHeaders; } interface OnBeforeRedirectFilter { @@ -6637,16 +6660,16 @@ declare namespace Electron { * Array of URL patterns that will be used to filter out the requests that do not * match the URL patterns. */ - urls?: string[]; + urls: string[]; } interface OnBeforeRequestDetails { - id?: number; - url?: string; - method?: string; - resourceType?: string; - timestamp?: number; - uploadData?: UploadData[]; + id: number; + url: string; + method: string; + resourceType: string; + timestamp: number; + uploadData: UploadData[]; } interface OnBeforeRequestFilter { @@ -6654,7 +6677,7 @@ declare namespace Electron { * Array of URL patterns that will be used to filter out the requests that do not * match the URL patterns. */ - urls?: string[]; + urls: string[]; } interface OnBeforeSendHeadersFilter { @@ -6662,19 +6685,19 @@ declare namespace Electron { * Array of URL patterns that will be used to filter out the requests that do not * match the URL patterns. */ - urls?: string[]; + urls: string[]; } interface OnCompletedDetails { - id?: number; - url?: string; - method?: string; - resourceType?: string; - timestamp?: number; - responseHeaders?: ResponseHeaders; - fromCache?: boolean; - statusCode?: number; - statusLine?: string; + id: number; + url: string; + method: string; + resourceType: string; + timestamp: number; + responseHeaders: ResponseHeaders; + fromCache: boolean; + statusCode: number; + statusLine: string; } interface OnCompletedFilter { @@ -6682,20 +6705,20 @@ declare namespace Electron { * Array of URL patterns that will be used to filter out the requests that do not * match the URL patterns. */ - urls?: string[]; + urls: string[]; } interface OnErrorOccurredDetails { - id?: number; - url?: string; - method?: string; - resourceType?: string; - timestamp?: number; - fromCache?: boolean; + id: number; + url: string; + method: string; + resourceType: string; + timestamp: number; + fromCache: boolean; /** * The error description. */ - error?: string; + error: string; } interface OnErrorOccurredFilter { @@ -6703,7 +6726,7 @@ declare namespace Electron { * Array of URL patterns that will be used to filter out the requests that do not * match the URL patterns. */ - urls?: string[]; + urls: string[]; } interface OnHeadersReceivedFilter { @@ -6711,22 +6734,22 @@ declare namespace Electron { * Array of URL patterns that will be used to filter out the requests that do not * match the URL patterns. */ - urls?: string[]; + urls: string[]; } interface OnResponseStartedDetails { - id?: number; - url?: string; - method?: string; - resourceType?: string; - timestamp?: number; - responseHeaders?: ResponseHeaders; + id: number; + url: string; + method: string; + resourceType: string; + timestamp: number; + responseHeaders: ResponseHeaders; /** * Indicates whether the response was fetched from disk cache. */ - fromCache?: boolean; - statusCode?: number; - statusLine?: string; + fromCache: boolean; + statusCode: number; + statusLine: string; } interface OnResponseStartedFilter { @@ -6734,16 +6757,16 @@ declare namespace Electron { * Array of URL patterns that will be used to filter out the requests that do not * match the URL patterns. */ - urls?: string[]; + urls: string[]; } interface OnSendHeadersDetails { - id?: number; - url?: string; - method?: string; - resourceType?: string; - timestamp?: number; - requestHeaders?: RequestHeaders; + id: number; + url: string; + method: string; + resourceType: string; + timestamp: number; + requestHeaders: RequestHeaders; } interface OnSendHeadersFilter { @@ -6751,15 +6774,16 @@ declare namespace Electron { * Array of URL patterns that will be used to filter out the requests that do not * match the URL patterns. */ - urls?: string[]; + urls: string[]; } interface OpenDevToolsOptions { /** - * Opens the devtools with specified dock state, can be , , , . Defaults to last - * used dock state. In mode it's possible to dock back. In mode it's not. + * Opens the devtools with specified dock state, can be right, bottom, undocked, + * detach. Defaults to last used dock state. In undocked mode it's possible to dock + * back. In detach mode it's not. */ - mode?: ('right' | 'bottom' | 'undocked' | 'detach'); + mode: ('right' | 'bottom' | 'undocked' | 'detach'); } interface OpenDialogOptions { @@ -6784,65 +6808,66 @@ declare namespace Electron { interface OpenExternalOptions { /** - * to bring the opened application to the foreground. The default is . + * true to bring the opened application to the foreground. The default is true. */ - activate?: boolean; + activate: boolean; } interface PageFaviconUpdatedEvent extends Event { /** * Array of URLs. */ - favicons?: string[]; + favicons: string[]; } interface PageTitleUpdatedEvent extends Event { - title?: string; - explicitSet?: boolean; + title: string; + explicitSet: boolean; } interface Parameters { /** - * Specify the screen type to emulate (default: ) + * Specify the screen type to emulate (default: desktop) */ - screenPosition?: ('desktop' | 'mobile'); + screenPosition: ('desktop' | 'mobile'); /** * Set the emulated screen size (screenPosition == mobile) */ - screenSize?: Size; + screenSize: Size; /** - * Position the view on the screen (screenPosition == mobile) (default: ) + * Position the view on the screen (screenPosition == mobile) (default: {x: 0, y: + * 0}) */ - viewPosition?: Point; + viewPosition: Point; /** * Set the device scale factor (if zero defaults to original device scale factor) - * (default: ) + * (default: 0) */ - deviceScaleFactor?: number; + deviceScaleFactor: number; /** * Set the emulated view size (empty means no override) */ - viewSize?: Size; + viewSize: Size; /** * Whether emulated view should be scaled down if necessary to fit into available - * space (default: ) + * space (default: false) */ - fitToView?: boolean; + fitToView: boolean; /** * Offset of the emulated view inside available space (not in fit to view mode) - * (default: ) + * (default: {x: 0, y: 0}) */ - offset?: Point; + offset: Point; /** * Scale of emulated view inside available space (not in fit to view mode) - * (default: ) + * (default: 1) */ - scale?: number; + scale: number; } interface PluginCrashedEvent extends Event { - name?: string; - version?: string; + name: string; + version: string; } interface PopupOptions { @@ -6851,12 +6876,12 @@ declare namespace Electron { */ x?: number; /** - * ( if is used) Default is the current mouse cursor position. + * ( if x is used) Default is the current mouse cursor position. */ - y?: number; + y: number; /** - * Set to to have this method return immediately called, to return after the menu - * has been selected or closed. Defaults to . + * Set to true to have this method return immediately called, false to return after + * the menu has been selected or closed. Defaults to false. */ async?: boolean; /** @@ -6868,13 +6893,13 @@ declare namespace Electron { interface PrintOptions { /** - * Don't ask user for print settings. Default is . + * Don't ask user for print settings. Default is false. */ - silent?: boolean; + silent: boolean; /** - * Also prints the background color and image of the web page. Default is . + * Also prints the background color and image of the web page. Default is false. */ - printBackground?: boolean; + printBackground: boolean; } interface PrintToPDFOptions { @@ -6884,8 +6909,8 @@ declare namespace Electron { */ marginsType?: number; /** - * Specify page size of the generated PDF. Can be , , , , , or an Object containing - * and in microns. + * Specify page size of the generated PDF. Can be A3, A4, A5, Legal, Letter, + * Tabloid or an Object containing height and width in microns. */ pageSize?: string; /** @@ -6897,7 +6922,7 @@ declare namespace Electron { */ printSelectionOnly?: boolean; /** - * for landscape, for portrait. + * true for landscape, false for portrait. */ landscape?: boolean; } @@ -6906,82 +6931,82 @@ declare namespace Electron { /** * The amount of memory currently pinned to actual physical RAM. */ - workingSetSize?: number; + workingSetSize: number; /** * The maximum amount of memory that has ever been pinned to actual physical RAM. */ - peakWorkingSetSize?: number; + peakWorkingSetSize: number; /** * The amount of memory not shared by other processes, such as JS heap or HTML * content. */ - privateBytes?: number; + privateBytes: number; /** * The amount of memory shared between processes, typically memory consumed by the * Electron code itself */ - sharedBytes?: number; + sharedBytes: number; } interface ProgressBarOptions { /** - * Mode for the progress bar. Can be , , , , or . + * Mode for the progress bar. Can be none, normal, indeterminate, error, or paused. */ - mode?: ('none' | 'normal' | 'indeterminate' | 'error'); + mode: ('none' | 'normal' | 'indeterminate' | 'error'); } interface Provider { /** - * Returns + * Returns Boolean */ - spellCheck?: (text?: string) => void; + spellCheck: (text: string) => void; } interface ReadBookmark { - title?: string; - url?: string; + title: string; + url: string; } interface RedirectRequest { - url?: string; - method?: string; + url: string; + method: string; session?: Session; uploadData?: UploadData; } interface RegisterBufferProtocolRequest { - url?: string; - referrer?: string; - method?: string; - uploadData?: UploadData[]; + url: string; + referrer: string; + method: string; + uploadData: UploadData[]; } interface RegisterFileProtocolRequest { - url?: string; - referrer?: string; - method?: string; - uploadData?: UploadData[]; + url: string; + referrer: string; + method: string; + uploadData: UploadData[]; } interface RegisterHttpProtocolRequest { - url?: string; - referrer?: string; - method?: string; - uploadData?: UploadData[]; + url: string; + referrer: string; + method: string; + uploadData: UploadData[]; } interface RegisterStandardSchemesOptions { /** - * to register the scheme as secure. Default . + * true to register the scheme as secure. Default false. */ secure?: boolean; } interface RegisterStringProtocolRequest { - url?: string; - referrer?: string; - method?: string; - uploadData?: UploadData[]; + url: string; + referrer: string; + method: string; + uploadData: UploadData[]; } interface RegisterURLSchemeAsPrivilegedOptions { @@ -7013,9 +7038,9 @@ declare namespace Electron { } interface Request { - method?: string; - url?: string; - referrer?: string; + method: string; + url: string; + referrer: string; } interface ResizeOptions { @@ -7028,21 +7053,21 @@ declare namespace Electron { */ height?: number; /** - * The desired quality of the resize image. Possible values are , or . The default - * is . These values express a desired quality/speed tradeoff. They are translated - * into an algorithm-specific method that depends on the capabilities (CPU, GPU) of - * the underlying platform. It is possible for all three methods to be mapped to - * the same algorithm on a given platform. + * The desired quality of the resize image. Possible values are good, better or + * best. The default is best. These values express a desired quality/speed + * tradeoff. They are translated into an algorithm-specific method that depends on + * the capabilities (CPU, GPU) of the underlying platform. It is possible for all + * three methods to be mapped to the same algorithm on a given platform. */ quality?: string; } interface ResourceUsage { - images?: MemoryUsageDetails; - cssStyleSheets?: MemoryUsageDetails; - xslStyleSheets?: MemoryUsageDetails; - fonts?: MemoryUsageDetails; - other?: MemoryUsageDetails; + images: MemoryUsageDetails; + cssStyleSheets: MemoryUsageDetails; + xslStyleSheets: MemoryUsageDetails; + fonts: MemoryUsageDetails; + other: MemoryUsageDetails; } interface Response { @@ -7055,20 +7080,20 @@ declare namespace Electron { } interface Result { - requestId?: number; + requestId: number; /** * Position of the active match. */ - activeMatchOrdinal?: number; + activeMatchOrdinal: number; /** * Number of Matches. */ - matches?: number; + matches: number; /** * Coordinates of first match region. */ - selectionArea?: SelectionArea; - finalUpdate?: boolean; + selectionArea: SelectionArea; + finalUpdate: boolean; } interface SaveDialogOptions { @@ -7089,20 +7114,22 @@ declare namespace Electron { */ nameFieldLabel?: string; /** - * Show the tags input box, defaults to . + * Show the tags input box, defaults to true. */ showsTagField?: boolean; } interface Settings { /** - * to open the app at login, to remove the app as a login item. Defaults to . + * true to open the app at login, false to remove the app as a login item. Defaults + * to false. */ openAtLogin?: boolean; /** - * to open the app as hidden. Defaults to . The user can edit this setting from the - * System Preferences so should be checked when the app is opened to know the - * current value. This setting is only supported on macOS. + * true to open the app as hidden. Defaults to false. The user can edit this + * setting from the System Preferences so + * app.getLoginItemStatus().wasOpenedAsHidden should be checked when the app is + * opened to know the current value. This setting is only supported on macOS. */ openAsHidden?: boolean; } @@ -7118,42 +7145,43 @@ declare namespace Electron { interface SourcesOptions { /** * An array of Strings that lists the types of desktop sources to be captured, - * available types are and . + * available types are screen and window. */ - types?: string[]; + types: string[]; /** - * The size that the media source thumbnail should be scaled to. Default is x . + * The size that the media source thumbnail should be scaled to. Default is 150 x + * 150. */ thumbnailSize?: Size; } interface StartMonitoringOptions { - categoryFilter?: string; - traceOptions?: string; + categoryFilter: string; + traceOptions: string; } interface StartRecordingOptions { - categoryFilter?: string; - traceOptions?: string; + categoryFilter: string; + traceOptions: string; } interface SystemMemoryInfo { /** * The total amount of physical memory in Kilobytes available to the system. */ - total?: number; + total: number; /** * The total amount of memory not being used by applications or disk cache. */ - free?: number; + free: number; /** * The total amount of swap memory in Kilobytes available to the system. */ - swapTotal?: number; + swapTotal: number; /** * The free amount of swap memory in Kilobytes available to the system. */ - swapFree?: number; + swapFree: number; } interface ToBitmapOptions { @@ -7183,7 +7211,7 @@ declare namespace Electron { */ label?: string; /** - * Button background color in hex format, i.e . + * Button background color in hex format, i.e #ABCDEF. */ backgroundColor?: string; /** @@ -7191,9 +7219,9 @@ declare namespace Electron { */ icon?: NativeImage; /** - * Can be , or . + * Can be left, right or overlay. */ - iconPosition?: ('left' | 'right' | 'overlay'); + iconPosition: ('left' | 'right' | 'overlay'); /** * Function to call when the button is clicked. */ @@ -7206,20 +7234,20 @@ declare namespace Electron { */ availableColors?: string[]; /** - * The selected hex color in the picker, i.e . + * The selected hex color in the picker, i.e #ABCDEF. */ selectedColor?: string; /** * Function to call when a color is selected. */ - change?: (color?: string) => void; + change?: (color: string) => void; } interface TouchBarGroupConstructorOptions { /** * Items to display as a group. */ - items?: TouchBar; + items: TouchBar; } interface TouchBarLabelConstructorOptions { @@ -7228,7 +7256,7 @@ declare namespace Electron { */ label?: string; /** - * Hex color of text, i.e . + * Hex color of text, i.e #ABCDEF. */ textColor?: string; } @@ -7247,8 +7275,8 @@ declare namespace Electron { */ items?: TouchBar; /** - * to display a close button on the left of the popover, to not show it. Default is - * . + * true to display a close button on the left of the popover, false to not show it. + * Default is true. */ showCloseButton?: boolean; } @@ -7257,35 +7285,35 @@ declare namespace Electron { /** * An array of items to place in this scrubber */ - items?: ScrubberItem[]; + items: ScrubberItem[]; /** * Called when the user taps an item that was not the last tapped item */ - select?: (selectedIndex?: number) => void; + select: (selectedIndex: number) => void; /** * Called when the user taps any item */ - highlight?: (highlightedIndex?: number) => void; + highlight: (highlightedIndex: number) => void; /** - * Selected item style. Defaults to . + * Selected item style. Defaults to null. */ - selectedStyle?: string; + selectedStyle: string; /** - * Selected overlay item style. Defaults to . + * Selected overlay item style. Defaults to null. */ - overlayStyle?: string; + overlayStyle: string; /** - * Defaults to . + * Defaults to false. */ - showArrowButtons?: boolean; + showArrowButtons: boolean; /** - * Defaults to . + * Defaults to free. */ - mode?: string; + mode: string; /** - * Defaults to . + * Defaults to true. */ - continuous?: boolean; + continuous: boolean; } interface TouchBarSegmentedControlConstructorOptions { @@ -7300,7 +7328,7 @@ declare namespace Electron { /** * An array of segments to place in this control. */ - segments?: SegmentedControlSegment[]; + segments: SegmentedControlSegment[]; /** * The index of the currently selected segment, will update automatically with user * interaction. When the mode is multiple it will be the last selected item. @@ -7309,7 +7337,7 @@ declare namespace Electron { /** * Called when the user selects a new segment */ - change?: (selectedIndex?: number, isSelected?: boolean) => void; + change: (selectedIndex: number, isSelected: boolean) => void; } interface TouchBarSliderConstructorOptions { @@ -7332,7 +7360,7 @@ declare namespace Electron { /** * Function to call when the slider is changed. */ - change?: (newValue?: number) => void; + change?: (newValue: number) => void; } interface TouchBarSpacerConstructorOptions { @@ -7343,7 +7371,7 @@ declare namespace Electron { } interface UpdateTargetUrlEvent extends Event { - url?: string; + url: string; } interface Versions { @@ -7358,58 +7386,58 @@ declare namespace Electron { } interface WillNavigateEvent extends Event { - url?: string; + url: string; } interface EditFlags { /** * Whether the renderer believes it can undo. */ - canUndo?: boolean; + canUndo: boolean; /** * Whether the renderer believes it can redo. */ - canRedo?: boolean; + canRedo: boolean; /** * Whether the renderer believes it can cut. */ - canCut?: boolean; + canCut: boolean; /** * Whether the renderer believes it can copy */ - canCopy?: boolean; + canCopy: boolean; /** * Whether the renderer believes it can paste. */ - canPaste?: boolean; + canPaste: boolean; /** * Whether the renderer believes it can delete. */ - canDelete?: boolean; + canDelete: boolean; /** * Whether the renderer believes it can select all. */ - canSelectAll?: boolean; + canSelectAll: boolean; } interface Extra { } interface FoundInPageResult { - requestId?: number; + requestId: number; /** * Position of the active match. */ - activeMatchOrdinal?: number; + activeMatchOrdinal: number; /** * Number of Matches. */ - matches?: number; + matches: number; /** * Coordinates of first match region. */ - selectionArea?: SelectionArea; - finalUpdate?: boolean; + selectionArea: SelectionArea; + finalUpdate: boolean; } interface Headers { @@ -7419,40 +7447,40 @@ declare namespace Electron { /** * Whether the media element has crashed. */ - inError?: boolean; + inError: boolean; /** * Whether the media element is paused. */ - isPaused?: boolean; + isPaused: boolean; /** * Whether the media element is muted. */ - isMuted?: boolean; + isMuted: boolean; /** * Whether the media element has audio. */ - hasAudio?: boolean; + hasAudio: boolean; /** * Whether the media element is looping. */ - isLooping?: boolean; + isLooping: boolean; /** * Whether the media element's controls are visible. */ - isControlsVisible?: boolean; + isControlsVisible: boolean; /** * Whether the media element's controls are toggleable. */ - canToggleControls?: boolean; + canToggleControls: boolean; /** * Whether the media element can be rotated. */ - canRotate?: boolean; + canRotate: boolean; } interface Normal { - width?: number; - height?: number; + width: number; + height: number; } interface Options { @@ -7469,17 +7497,17 @@ declare namespace Electron { interface WebPreferences { /** - * Whether to enable DevTools. If it is set to , can not use to open DevTools. - * Default is . + * Whether to enable DevTools. If it is set to false, can not use + * BrowserWindow.webContents.openDevTools() to open DevTools. Default is true. */ devTools?: boolean; /** - * Whether node integration is enabled. Default is . + * Whether node integration is enabled. Default is true. */ nodeIntegration?: boolean; /** - * Whether node integration is enabled in web workers. Default is . More about this - * can be found in . + * Whether node integration is enabled in web workers. Default is false. More about + * this can be found in . */ nodeIntegrationInWorker?: boolean; /** @@ -7493,84 +7521,86 @@ declare namespace Electron { /** * If set, this will sandbox the renderer associated with the window, making it * compatible with the Chromium OS-level sandbox and disabling the Node.js engine. - * This is not the same as the option and the APIs available to the preload script - * are more limited. Read more about the option . This option is currently - * experimental and may change or be removed in future Electron releases. + * This is not the same as the nodeIntegration option and the APIs available to the + * preload script are more limited. Read more about the option . This option is + * currently experimental and may change or be removed in future Electron releases. */ sandbox?: boolean; /** * Sets the session used by the page. Instead of passing the Session object - * directly, you can also choose to use the option instead, which accepts a - * partition string. When both and are provided, will be preferred. Default is the - * default session. + * directly, you can also choose to use the partition option instead, which accepts + * a partition string. When both session and partition are provided, session will + * be preferred. Default is the default session. */ session?: Session; /** * Sets the session used by the page according to the session's partition string. - * If starts with , the page will use a persistent session available to all pages - * in the app with the same . If there is no prefix, the page will use an in-memory - * session. By assigning the same , multiple pages can share the same session. - * Default is the default session. + * If partition starts with persist:, the page will use a persistent session + * available to all pages in the app with the same partition. If there is no + * persist: prefix, the page will use an in-memory session. By assigning the same + * partition, multiple pages can share the same session. Default is the default + * session. */ partition?: string; /** - * The default zoom factor of the page, represents . Default is . + * The default zoom factor of the page, 3.0 represents 300%. Default is 1.0. */ zoomFactor?: number; /** - * Enables JavaScript support. Default is . + * Enables JavaScript support. Default is true. */ javascript?: boolean; /** - * When , it will disable the same-origin policy (usually using testing websites by - * people), and set to if this options has not been set by user. Default is . + * When false, it will disable the same-origin policy (usually using testing + * websites by people), and set allowRunningInsecureContent to true if this options + * has not been set by user. Default is true. */ webSecurity?: boolean; /** * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is - * . + * false. */ allowRunningInsecureContent?: boolean; /** - * Enables image support. Default is . + * Enables image support. Default is true. */ images?: boolean; /** - * Make TextArea elements resizable. Default is . + * Make TextArea elements resizable. Default is true. */ textAreasAreResizable?: boolean; /** - * Enables WebGL support. Default is . + * Enables WebGL support. Default is true. */ webgl?: boolean; /** - * Enables WebAudio support. Default is . + * Enables WebAudio support. Default is true. */ webaudio?: boolean; /** - * Whether plugins should be enabled. Default is . + * Whether plugins should be enabled. Default is false. */ plugins?: boolean; /** - * Enables Chromium's experimental features. Default is . + * Enables Chromium's experimental features. Default is false. */ experimentalFeatures?: boolean; /** - * Enables Chromium's experimental canvas features. Default is . + * Enables Chromium's experimental canvas features. Default is false. */ experimentalCanvasFeatures?: boolean; /** - * Enables scroll bounce (rubber banding) effect on macOS. Default is . + * Enables scroll bounce (rubber banding) effect on macOS. Default is false. */ scrollBounce?: boolean; /** - * A list of feature strings separated by , like to enable. The full list of - * supported feature strings can be found in the file. + * A list of feature strings separated by ,, like CSSVariables,KeyboardEventKey to + * enable. The full list of supported feature strings can be found in the file. */ blinkFeatures?: string; /** - * A list of feature strings separated by , like to disable. The full list of - * supported feature strings can be found in the file. + * A list of feature strings separated by ,, like CSSVariables,KeyboardEventKey to + * disable. The full list of supported feature strings can be found in the file. */ disableBlinkFeatures?: string; /** @@ -7578,71 +7608,71 @@ declare namespace Electron { */ defaultFontFamily?: DefaultFontFamily; /** - * Defaults to . + * Defaults to 16. */ defaultFontSize?: number; /** - * Defaults to . + * Defaults to 13. */ defaultMonospaceFontSize?: number; /** - * Defaults to . + * Defaults to 0. */ minimumFontSize?: number; /** - * Defaults to . + * Defaults to ISO-8859-1. */ defaultEncoding?: string; /** * Whether to throttle animations and timers when the page becomes background. - * Defaults to . + * Defaults to true. */ backgroundThrottling?: boolean; /** - * Whether to enable offscreen rendering for the browser window. Defaults to . See - * the for more details. + * Whether to enable offscreen rendering for the browser window. Defaults to false. + * See the for more details. */ offscreen?: boolean; /** - * Whether to run Electron APIs and the specified script in a separate JavaScript - * context. Defaults to . The context that the script runs in will still have full - * access to the and globals but it will use its own set of JavaScript builtins (, - * , , etc.) and will be isolated from any changes made to the global environment - * by the loaded page. The Electron API will only be available in the script and - * not the loaded page. This option should be used when loading potentially - * untrusted remote content to ensure the loaded content cannot tamper with the - * script and any Electron APIs being used. This option uses the same technique - * used by . You can access this context in the dev tools by selecting the - * 'Electron Isolated Context' entry in the combo box at the top of the Console - * tab. This option is currently experimental and may change or be removed in - * future Electron releases. + * Whether to run Electron APIs and the specified preload script in a separate + * JavaScript context. Defaults to false. The context that the preload script runs + * in will still have full access to the document and window globals but it will + * use its own set of JavaScript builtins (Array, Object, JSON, etc.) and will be + * isolated from any changes made to the global environment by the loaded page. The + * Electron API will only be available in the preload script and not the loaded + * page. This option should be used when loading potentially untrusted remote + * content to ensure the loaded content cannot tamper with the preload script and + * any Electron APIs being used. This option uses the same technique used by . You + * can access this context in the dev tools by selecting the 'Electron Isolated + * Context' entry in the combo box at the top of the Console tab. This option is + * currently experimental and may change or be removed in future Electron releases. */ contextIsolation?: boolean; } interface DefaultFontFamily { /** - * Defaults to . + * Defaults to Times New Roman. */ standard?: string; /** - * Defaults to . + * Defaults to Times New Roman. */ serif?: string; /** - * Defaults to . + * Defaults to Arial. */ sansSerif?: string; /** - * Defaults to . + * Defaults to Courier New. */ monospace?: string; /** - * Defaults to . + * Defaults to Script. */ cursive?: string; /** - * Defaults to . + * Defaults to Impact. */ fantasy?: string; } @@ -7693,8 +7723,8 @@ declare namespace NodeJS { * Causes the main thread of the current process crash. */ crash(): void; - getCPUUsage(CPUUsage: CPUUsage): void; - getIOCounters(IOCounters: IOCounters): void; + getCPUUsage(CPUUsage: Electron.CPUUsage): void; + getIOCounters(IOCounters: Electron.IOCounters): void; /** * Returns an object giving memory usage statistics about the current process. Note * that all statistics are reported in Kilobytes. From 3898a13e574314aca141298d15f8fc6da8f6b70a Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 16 May 2017 12:37:38 -0700 Subject: [PATCH 316/328] Update to Electron v1.6.10 --- npm/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/package.json b/npm/package.json index 76a33fee1c72..a92f0ff28daf 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.7.0", + "version": "1.6.10", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { @@ -33,4 +33,4 @@ "keywords": [ "electron" ] -} +} \ No newline at end of file From 1206689caab0e719643859b7984059d4af322e24 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 16 May 2017 14:37:10 -0700 Subject: [PATCH 317/328] Update to electron.d.ts@1.7.1 --- npm/electron.d.ts | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/npm/electron.d.ts b/npm/electron.d.ts index fc32d23f4878..1e1f2e3afb3e 100644 --- a/npm/electron.d.ts +++ b/npm/electron.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Electron 1.6.10 +// Type definitions for Electron 1.7.1 // Project: http://electron.atom.io/ // Definitions by: The Electron Team // Definitions: https://github.com/electron/electron-typescript-definitions @@ -2199,16 +2199,16 @@ declare namespace Electron { * Shows a message box, it will block the process until the message box is closed. * It returns the index of the clicked button. The browserWindow argument allows * the dialog to attach itself to a parent window, making it modal. If a callback - * is passed, the API call will be asynchronous and the result will be passed via - * callback(response). + * is passed, the dialog will not block the process. The API call will be + * asynchronous and the result will be passed via callback(response). */ showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions, callback?: (response: number, checkboxChecked: boolean) => void): number; /** * Shows a message box, it will block the process until the message box is closed. * It returns the index of the clicked button. The browserWindow argument allows * the dialog to attach itself to a parent window, making it modal. If a callback - * is passed, the API call will be asynchronous and the result will be passed via - * callback(response). + * is passed, the dialog will not block the process. The API call will be + * asynchronous and the result will be passed via callback(response). */ showMessageBox(options: MessageBoxOptions, callback?: (response: number, checkboxChecked: boolean) => void): number; /** @@ -4627,6 +4627,15 @@ declare namespace Electron { url: string) => void): this; removeListener(event: 'will-navigate', listener: (event: Event, url: string) => void): this; + /** + * Emitted when a beforeunload event handler is attempting to cancel a page unload. + * Calling event.preventDefault() will ignore the beforeunload event handler and + * allow the page to be unloaded. + */ + on(event: 'will-prevent-unload', listener: (event: Event) => void): this; + once(event: 'will-prevent-unload', listener: (event: Event) => void): this; + addListener(event: 'will-prevent-unload', listener: (event: Event) => void): this; + removeListener(event: 'will-prevent-unload', listener: (event: Event) => void): this; /** * Adds the specified path to DevTools workspace. Must be used after DevTools * creation: @@ -4730,6 +4739,7 @@ declare namespace Electron { */ findInPage(text: string, options?: FindInPageOptions): void; getFrameRate(): number; + getOSProcessId(): number; getTitle(): string; getURL(): string; getUserAgent(): string; @@ -7648,6 +7658,10 @@ declare namespace Electron { * currently experimental and may change or be removed in future Electron releases. */ contextIsolation?: boolean; + /** + * Whether to use native window.open(). Defaults to false. + */ + nativeWindowOpen?: boolean; } interface DefaultFontFamily { From 09f31f559da4302ab6394affebc30cc21eb3b911 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 16 May 2017 14:41:41 -0700 Subject: [PATCH 318/328] Update to Electron v1.7.1 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index a92f0ff28daf..362c4319b08f 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.6.10", + "version": "1.7.1", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 28100a8695e3f683d7efb873f8dae4706ce54b6f Mon Sep 17 00:00:00 2001 From: Jordan Piepkow Date: Tue, 23 May 2017 15:26:22 -0400 Subject: [PATCH 319/328] added force option in electron-download. Downloading from cache causes a checksum check that causes some builds to fail(see https://github.com/electron/electron/issues/8653) that that rely on stable electron releases(pre electron v1.7.0 beta) where chromedrive is not named based on electron version. This will add the option to always force a redownload. --- npm/install.js | 1 + 1 file changed, 1 insertion(+) diff --git a/npm/install.js b/npm/install.js index 7ffc429a0bf1..f49189d4c3d1 100755 --- a/npm/install.js +++ b/npm/install.js @@ -29,6 +29,7 @@ download({ platform: process.env.npm_config_platform, arch: process.env.npm_config_arch, strictSSL: process.env.npm_config_strict_ssl === 'true', + force: process.env.force_no_cache || false, quiet: ['info', 'verbose', 'silly', 'http'].indexOf(process.env.npm_config_loglevel) === -1 }, extractFile) From ffc22ef926c623efd8f3f29c5d3e0daf0010b482 Mon Sep 17 00:00:00 2001 From: Jordan Piepkow Date: Tue, 23 May 2017 16:16:01 -0400 Subject: [PATCH 320/328] switched to the more standard approach in this file Switched to defaulting back to string 'false' as that is how it was already doing strictSSL and electron-download treats and checks both against bools so would make sense to keep it the same across the document. --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index f49189d4c3d1..3a93295f35db 100755 --- a/npm/install.js +++ b/npm/install.js @@ -29,7 +29,7 @@ download({ platform: process.env.npm_config_platform, arch: process.env.npm_config_arch, strictSSL: process.env.npm_config_strict_ssl === 'true', - force: process.env.force_no_cache || false, + force: process.env.force_no_cache === 'true', quiet: ['info', 'verbose', 'silly', 'http'].indexOf(process.env.npm_config_loglevel) === -1 }, extractFile) From 85d6b74be21bff9529cec9b1d3985b77c555412c Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 25 May 2017 12:52:38 -0700 Subject: [PATCH 321/328] Update to Electron v1.6.11 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 362c4319b08f..ae35311602a4 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.7.1", + "version": "1.6.11", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 364709541589875005f48731e4dc843cdbdb36ba Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 26 May 2017 13:09:34 -0700 Subject: [PATCH 322/328] Upgrade typescript file to 1.7.2 --- npm/electron.d.ts | 90 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 68 insertions(+), 22 deletions(-) diff --git a/npm/electron.d.ts b/npm/electron.d.ts index 1e1f2e3afb3e..fe8e5593d6b7 100644 --- a/npm/electron.d.ts +++ b/npm/electron.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Electron 1.7.1 +// Type definitions for Electron 1.7.2 // Project: http://electron.atom.io/ // Definitions by: The Electron Team // Definitions: https://github.com/electron/electron-typescript-definitions @@ -482,10 +482,16 @@ declare namespace Electron { */ focus(): void; /** - * Returns ProcessMemoryInfo[]: Array of ProcessMemoryInfo objects that correspond - * to memory usage statistics of all the processes associated with the app. + * Returns ProcessMetric[]: Array of ProcessMetric objects that correspond to + * memory and cpu usage statistics of all the processes associated with the app. + * Note: This method is deprecated, use app.getAppMetrics() instead. */ getAppMemoryInfo(): void; + /** + * Returns ProcessMetric[]: Array of ProcessMetric objects that correspond to + * memory and cpu usage statistics of all the processes associated with the app. + */ + getAppMetrics(): void; getAppPath(): string; getBadgeCount(): number; getCurrentActivityType(): string; @@ -493,12 +499,12 @@ declare namespace Electron { * Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux * and macOS, icons depend on the application associated with file mime type. */ - getFileIcon(path: string, options: FileIconOptions, callback: (error: Error, icon: NativeImage) => void): void; + getFileIcon(path: string, callback: (error: Error, icon: NativeImage) => void): void; /** * Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux * and macOS, icons depend on the application associated with file mime type. */ - getFileIcon(path: string, callback: (error: Error, icon: NativeImage) => void): void; + getFileIcon(path: string, options: FileIconOptions, callback: (error: Error, icon: NativeImage) => void): void; getJumpListSettings(): JumpListSettings; /** * Note: When distributing your packaged app, you have to also ship the locales @@ -1735,6 +1741,10 @@ declare namespace Electron { * to write both a bookmark and fallback text to the clipboard. */ writeBookmark(title: string, url: string, type?: string): void; + /** + * Writes the buffer into the clipboard as format. + */ + writeBuffer(format: string, buffer: Buffer, type?: string): void; /** * Writes the text into the find pasteboard as plain text. This method uses * synchronous IPC when called from the renderer process. @@ -2505,9 +2515,9 @@ declare namespace Electron { */ once(channel: string, listener: Function): this; /** - * Removes all listeners, or those of the specified channel. + * Removes listeners of the specified channel. */ - removeAllListeners(channel?: string): this; + removeAllListeners(channel: string): this; /** * Removes the specified listener from the listener array for the specified * channel. @@ -2876,18 +2886,36 @@ declare namespace Electron { stop(id: number): void; } - interface ProcessMemoryInfo { + interface PrinterInfo { - // Docs: http://electron.atom.io/docs/api/structures/process-memory-info + // Docs: http://electron.atom.io/docs/api/structures/printer-info + + description: string; + isDefault: boolean; + name: string; + status: number; + } + + interface ProcessMetric { + + // Docs: http://electron.atom.io/docs/api/structures/process-metric /** - * Memory information of the process. + * CPU usage of the process. + */ + cpu: CPUUsage; + /** + * Memory information for the process. */ memory: MemoryInfo; /** * Process id of the process. */ pid: number; + /** + * Process type (Browser or Tab or GPU etc). + */ + type: string; } interface Protocol extends EventEmitter { @@ -3417,10 +3445,9 @@ declare namespace Electron { getAccentColor(): string; getColor(color: '3d-dark-shadow' | '3d-face' | '3d-highlight' | '3d-light' | '3d-shadow' | 'active-border' | 'active-caption' | 'active-caption-gradient' | 'app-workspace' | 'button-text' | 'caption-text' | 'desktop' | 'disabled-text' | 'highlight' | 'highlight-text' | 'hotlight' | 'inactive-border' | 'inactive-caption' | 'inactive-caption-gradient' | 'inactive-caption-text' | 'info-background' | 'info-text' | 'menu' | 'menu-highlight' | 'menubar' | 'menu-text' | 'scrollbar' | 'window' | 'window-frame' | 'window-text'): string; /** - * Get the value of key in system preferences. This API uses NSUserDefaults on - * macOS. Some popular key and types are: + * This API uses NSUserDefaults on macOS. Some popular key and types are: */ - getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): void; + getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): any; /** * This method returns true if DWM composition (Aero Glass) is enabled, and false * otherwise. An example of using it to determine if you should create a @@ -4564,7 +4591,8 @@ declare namespace Electron { * Calling event.preventDefault() will destroy the guest page. This event can be * used to configure webPreferences for the webContents of a before it's * loaded, and provides the ability to set settings that can't be set via - * attributes. + * attributes. Note: The specified preload script option will be appear as + * preloadURL (not preload) in the webPreferences object emitted with this event. */ on(event: 'will-attach-webview', listener: (event: Event, /** @@ -4675,13 +4703,13 @@ declare namespace Electron { * called with callback(image). The image is an instance of NativeImage that stores * data of the snapshot. Omitting rect will capture the whole visible page. */ - capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; + capturePage(callback: (image: NativeImage) => void): void; /** * Captures a snapshot of the page within rect. Upon completion callback will be * called with callback(image). The image is an instance of NativeImage that stores * data of the snapshot. Omitting rect will capture the whole visible page. */ - capturePage(callback: (image: NativeImage) => void): void; + capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; /** * Clears the navigation history. */ @@ -4740,6 +4768,10 @@ declare namespace Electron { findInPage(text: string, options?: FindInPageOptions): void; getFrameRate(): number; getOSProcessId(): number; + /** + * Get the system printer list. Returns PrinterInfo[] + */ + getPrinters(): void; getTitle(): string; getURL(): string; getUserAgent(): string; @@ -4827,11 +4859,11 @@ declare namespace Electron { */ pasteAndMatchStyle(): void; /** - * Prints window's web page. When silent is set to true, Electron will pick up - * system's default printer and default settings for printing. Calling - * window.print() in web page is equivalent to calling webContents.print({silent: - * false, printBackground: false}). Use page-break-before: always; CSS style to - * force to print to a new page. + * Prints window's web page. When silent is set to true, Electron will pick the + * system's default printer if deviceName is empty and the default settings for + * printing. Calling window.print() in web page is equivalent to calling + * webContents.print({silent: false, printBackground: false, deviceName: ''}). Use + * page-break-before: always; CSS style to force to print to a new page. */ print(options?: PrintOptions): void; /** @@ -5569,7 +5601,8 @@ declare namespace Electron { * will be loaded by require in guest page under the hood. When the guest page * doesn't have node integration this script will still have access to all Node * APIs, but global objects injected by Node will be deleted after this script has - * finished executing. + * finished executing. Note: This option will be appear as preloadURL (not preload) + * in the webPreferences specified to the will-attach-webview event. */ preload?: string; /** @@ -6910,6 +6943,10 @@ declare namespace Electron { * Also prints the background color and image of the web page. Default is false. */ printBackground: boolean; + /** + * Set the printer device name to use. Default is ''. + */ + deviceName?: string; } interface PrintToPDFOptions { @@ -7662,6 +7699,15 @@ declare namespace Electron { * Whether to use native window.open(). Defaults to false. */ nativeWindowOpen?: boolean; + /** + * Whether to enable the . Defaults to the value of the nodeIntegration option. The + * preload script configured for the will have node integration enabled + * when it is executed so you should ensure remote/untrusted content is not able to + * create a tag with a possibly malicious preload script. You can use the + * will-attach-webview event on to strip away the preload script and to validate or + * alter the 's initial settings. + */ + webviewTag?: boolean; } interface DefaultFontFamily { From 256b5c8a17a1547c6ec1451aecf879f7bc662061 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Fri, 26 May 2017 13:39:08 -0700 Subject: [PATCH 323/328] Update to Electron v1.7.2 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index ae35311602a4..ee57492c455e 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.6.11", + "version": "1.7.2", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 063df812310a46a3a7ec96ebc86f897070f645f2 Mon Sep 17 00:00:00 2001 From: Jordan Piepkow Date: Thu, 1 Jun 2017 14:30:39 -0400 Subject: [PATCH 324/328] Update README.md --- npm/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/npm/README.md b/npm/README.md index f9c079b55dad..c82de731daf6 100644 --- a/npm/README.md +++ b/npm/README.md @@ -59,6 +59,8 @@ If you want to change the architecture that is downloaded (e.g., `ia32` on an npm install --arch=ia32 electron ``` +If you need to force a re-download of the asset and the SHASUM file set the `force_no_cache` enviroment variable to true. + ## About Works on Mac, Windows and Linux OSes that Electron supports (e.g. Electron From 51126c7c35ca13b38f6f0dfce845fb456a43556a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 8 Jun 2017 15:31:29 -0700 Subject: [PATCH 325/328] Add electron.d.ts@1.7.3 --- npm/electron.d.ts | 227 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 187 insertions(+), 40 deletions(-) diff --git a/npm/electron.d.ts b/npm/electron.d.ts index fe8e5593d6b7..7c800f884da9 100644 --- a/npm/electron.d.ts +++ b/npm/electron.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Electron 1.7.2 +// Type definitions for Electron 1.7.3 // Project: http://electron.atom.io/ // Definitions by: The Electron Team // Definitions: https://github.com/electron/electron-typescript-definitions @@ -62,6 +62,7 @@ declare namespace Electron { Menu: typeof Electron.Menu; MenuItem: typeof Electron.MenuItem; net: Electron.Net; + Notification: typeof Electron.Notification; powerMonitor: Electron.PowerMonitor; powerSaveBlocker: Electron.PowerSaveBlocker; protocol: Electron.Protocol; @@ -105,6 +106,7 @@ declare namespace Electron { MenuItem: typeof Electron.MenuItem; nativeImage: typeof Electron.NativeImage; net: Electron.Net; + Notification: typeof Electron.Notification; powerMonitor: Electron.PowerMonitor; powerSaveBlocker: Electron.PowerSaveBlocker; protocol: Electron.Protocol; @@ -481,17 +483,8 @@ declare namespace Electron { * the active app. On Windows, focuses on the application's first window. */ focus(): void; - /** - * Returns ProcessMetric[]: Array of ProcessMetric objects that correspond to - * memory and cpu usage statistics of all the processes associated with the app. - * Note: This method is deprecated, use app.getAppMetrics() instead. - */ - getAppMemoryInfo(): void; - /** - * Returns ProcessMetric[]: Array of ProcessMetric objects that correspond to - * memory and cpu usage statistics of all the processes associated with the app. - */ - getAppMetrics(): void; + getAppMemoryInfo(): ProcessMetric[]; + getAppMetrics(): ProcessMetric[]; getAppPath(): string; getBadgeCount(): number; getCurrentActivityType(): string; @@ -499,12 +492,13 @@ declare namespace Electron { * Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux * and macOS, icons depend on the application associated with file mime type. */ - getFileIcon(path: string, callback: (error: Error, icon: NativeImage) => void): void; + getFileIcon(path: string, options: FileIconOptions, callback: (error: Error, icon: NativeImage) => void): void; /** * Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux * and macOS, icons depend on the application associated with file mime type. */ - getFileIcon(path: string, options: FileIconOptions, callback: (error: Error, icon: NativeImage) => void): void; + getFileIcon(path: string, callback: (error: Error, icon: NativeImage) => void): void; + getGpuFeatureStatus(): GPUFeatureStatus; getJumpListSettings(): JumpListSettings; /** * Note: When distributing your packaged app, you have to also ship the locales @@ -1678,10 +1672,7 @@ declare namespace Electron { * Continues any deferred redirection request when the redirection mode is manual. */ followRedirect(): void; - /** - * Returns Object - The value of a previously set extra header name. - */ - getHeader(name: string): void; + getHeader(name: string): Header; /** * Removes a previously set extra header name. This method can be called only * before first write. Trying to call it after the first write will throw an error. @@ -1948,10 +1939,9 @@ declare namespace Electron { flushStore(callback: Function): void; /** * Sends a request to get all cookies matching details, callback will be called - * with callback(error, cookies) on complete. cookies is an Array of cookie - * objects. + * with callback(error, cookies) on complete. */ - get(filter: Filter, callback: (error: Error, cookies: Cookies[]) => void): void; + get(filter: Filter, callback: (error: Error, cookies: Cookie[]) => void): void; /** * Removes the cookies matching url and name, callback will called with callback() * on complete. @@ -2409,6 +2399,64 @@ declare namespace Electron { unregisterAll(): void; } + interface GPUFeatureStatus { + + // Docs: http://electron.atom.io/docs/api/structures/gpu-feature-status + + /** + * Canvas + */ + '2d_canvas': string; + /** + * Flash + */ + flash_3d: string; + /** + * Flash Stage3D + */ + flash_stage3d: string; + /** + * Flash Stage3D Baseline profile + */ + flash_stage3d_baseline: string; + /** + * Compositing + */ + gpu_compositing: string; + /** + * Multiple Raster Threads + */ + multiple_raster_threads: string; + /** + * Native GpuMemoryBuffers + */ + native_gpu_memory_buffers: string; + /** + * Rasterization + */ + rasterization: string; + /** + * Video Decode + */ + video_decode: string; + /** + * Video Encode + */ + video_encode: string; + /** + * VPx Video Decode + */ + vpx_decode: string; + /** + * WebGL + */ + webgl: string; + /** + * WebGL2 + */ + webgl2: string; + } + class IncomingMessage extends EventEmitter { // Docs: http://electron.atom.io/docs/api/incoming-message @@ -2822,6 +2870,70 @@ declare namespace Electron { request(options: any | string): ClientRequest; } + class Notification extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/notification + + /** + * Emitted when the notification is clicked by the user. + */ + on(event: 'click', listener: (event: Event) => void): this; + once(event: 'click', listener: (event: Event) => void): this; + addListener(event: 'click', listener: (event: Event) => void): this; + removeListener(event: 'click', listener: (event: Event) => void): this; + /** + * Emitted when the notification is closed by manual intervention from the user. + * This event is not guarunteed to be emitted in all cases where the notification + * is closed. + */ + on(event: 'close', listener: (event: Event) => void): this; + once(event: 'close', listener: (event: Event) => void): this; + addListener(event: 'close', listener: (event: Event) => void): this; + removeListener(event: 'close', listener: (event: Event) => void): this; + /** + * Emitted when the user clicks the "Reply" button on a notification with hasReply: + * true. + */ + on(event: 'reply', listener: (event: Event, + /** + * The string the user entered into the inline reply field + */ + reply: string) => void): this; + once(event: 'reply', listener: (event: Event, + /** + * The string the user entered into the inline reply field + */ + reply: string) => void): this; + addListener(event: 'reply', listener: (event: Event, + /** + * The string the user entered into the inline reply field + */ + reply: string) => void): this; + removeListener(event: 'reply', listener: (event: Event, + /** + * The string the user entered into the inline reply field + */ + reply: string) => void): this; + /** + * Emitted when the notification is shown to the user, note this could be fired + * multiple times as a notification can be shown multiple times through the show() + * method. + */ + on(event: 'show', listener: (event: Event) => void): this; + once(event: 'show', listener: (event: Event) => void): this; + addListener(event: 'show', listener: (event: Event) => void): this; + removeListener(event: 'show', listener: (event: Event) => void): this; + constructor(options: NotificationConstructorOptions); + static isSupported(): boolean; + /** + * Immediately shows the notification to the user, please note this means unlike + * the HTML5 Notification implementation, simply instantiating a new Notification + * does not immediately show it to the user, you need to call this method before + * the OS will display it. + */ + show(): void; + } + interface Point { // Docs: http://electron.atom.io/docs/api/structures/point @@ -3145,6 +3257,7 @@ declare namespace Electron { getCursorScreenPoint(): Point; getDisplayMatching(rect: Rectangle): Display; getDisplayNearestPoint(point: Point): Display; + getMenuBarHeight(): number; getPrimaryDisplay(): Display; } @@ -3449,12 +3562,10 @@ declare namespace Electron { */ getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): any; /** - * This method returns true if DWM composition (Aero Glass) is enabled, and false - * otherwise. An example of using it to determine if you should create a - * transparent window or not (transparent windows won't work correctly when DWM - * composition is disabled): + * An example of using it to determine if you should create a transparent window or + * not (transparent windows won't work correctly when DWM composition is disabled): */ - isAeroGlassEnabled(): void; + isAeroGlassEnabled(): boolean; isDarkMode(): boolean; isInvertedColorScheme(): boolean; isSwipeTrackingFromScrollEventsEnabled(): boolean; @@ -4769,9 +4880,9 @@ declare namespace Electron { getFrameRate(): number; getOSProcessId(): number; /** - * Get the system printer list. Returns PrinterInfo[] + * Get the system printer list. */ - getPrinters(): void; + getPrinters(): PrinterInfo[]; getTitle(): string; getURL(): string; getUserAgent(): string; @@ -4913,10 +5024,11 @@ declare namespace Electron { */ send(channel: string, ...args: any[]): void; /** - * Sends an input event to the page. For keyboard events, the event object also - * have following properties: For mouse events, the event object also have - * following properties: For the mouseWheel event, the event object also have - * following properties: + * Sends an input event to the page. Note: The BrowserWindow containing the + * contents needs to be focused for sendInputEvent() to work. For keyboard events, + * the event object also have following properties: For mouse events, the event + * object also have following properties: For the mouseWheel event, the event + * object also have following properties: */ sendInputEvent(event: Event): void; /** @@ -5899,7 +6011,7 @@ declare namespace Electron { /** * The style of window title bar. Default is default. Possible values are: */ - titleBarStyle?: ('default' | 'hidden' | 'hidden-inset'); + titleBarStyle?: ('default' | 'hidden' | 'hidden-inset' | 'hiddenInset' | 'customButtonsOnHover'); /** * Use WS_THICKFRAME style for frameless windows on Windows, which adds standard * window frame. Setting it to false will remove window shadow and window @@ -6381,6 +6493,13 @@ declare namespace Electron { cache: boolean; } + interface Header { + /** + * Specify an extra header name. + */ + name: string; + } + interface ImportCertificateOptions { /** * Path for the pkcs12 file. @@ -6682,6 +6801,34 @@ declare namespace Electron { options: Options; } + interface NotificationConstructorOptions { + /** + * A title for the notification, which will be shown at the top of the notification + * window when it is shown + */ + title: string; + /** + * The body text of the notification, which will be displayed below the title + */ + body: string; + /** + * Whether or not to emit an OS notification noise when showing the notification + */ + silent?: boolean; + /** + * An icon to use in the notification + */ + icon?: NativeImage; + /** + * Whether or not to add an inline reply option to the notification. + */ + hasReply?: boolean; + /** + * The placeholder to write in the inline reply input field. + */ + replyPlaceholder?: string; + } + interface OnBeforeRedirectDetails { id: string; url: string; @@ -6915,13 +7062,13 @@ declare namespace Electron { interface PopupOptions { /** - * Default is the current mouse cursor position. + * Default is the current mouse cursor position. Must be declared if y is declared. */ x?: number; /** - * ( if x is used) Default is the current mouse cursor position. + * Default is the current mouse cursor position. Must be declared if x is declared. */ - y: number; + y?: number; /** * Set to true to have this method return immediately called, false to return after * the menu has been selected or closed. Defaults to false. @@ -7671,8 +7818,8 @@ declare namespace Electron { */ defaultEncoding?: string; /** - * Whether to throttle animations and timers when the page becomes background. - * Defaults to true. + * Whether to throttle animations and timers when the page becomes background. This + * also affects the [Page Visibility API][#page-visibility]. Defaults to true. */ backgroundThrottling?: boolean; /** @@ -7783,8 +7930,8 @@ declare namespace NodeJS { * Causes the main thread of the current process crash. */ crash(): void; - getCPUUsage(CPUUsage: Electron.CPUUsage): void; - getIOCounters(IOCounters: Electron.IOCounters): void; + getCPUUsage(): Electron.CPUUsage; + getIOCounters(): Electron.IOCounters; /** * Returns an object giving memory usage statistics about the current process. Note * that all statistics are reported in Kilobytes. From 68164aeff255ee106b738ead5f911a0bbed58cc7 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 8 Jun 2017 15:46:02 -0700 Subject: [PATCH 326/328] Update to Electron v1.7.3 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index ee57492c455e..01962cde7376 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.7.2", + "version": "1.7.3", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": { From 97d0c6e5052b528ee2d4abbb6f0bab9188c64c8e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 28 Jun 2017 15:18:59 -0700 Subject: [PATCH 327/328] Upgrade .d.ts file to 1.7.4 --- npm/electron.d.ts | 240 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 201 insertions(+), 39 deletions(-) diff --git a/npm/electron.d.ts b/npm/electron.d.ts index 7c800f884da9..df9c5792361f 100644 --- a/npm/electron.d.ts +++ b/npm/electron.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Electron 1.7.3 +// Type definitions for Electron 1.7.4 // Project: http://electron.atom.io/ // Definitions by: The Electron Team // Definitions: https://github.com/electron/electron-typescript-definitions @@ -333,6 +333,14 @@ declare namespace Electron { request: Request, authInfo: AuthInfo, callback: (username: string, password: string) => void) => void): this; + /** + * Emitted when the user clicks the native macOS new tab button. The new tab button + * is only visible if the current BrowserWindow has a tabbingIdentifier + */ + on(event: 'new-window-for-tab', listener: (event: Event) => void): this; + once(event: 'new-window-for-tab', listener: (event: Event) => void): this; + addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this; + removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this; /** * Emitted when the user wants to open a file with the application. The open-file * event is usually emitted when the application is already open and the OS wants @@ -472,6 +480,11 @@ declare namespace Electron { * before app is ready. */ disableHardwareAcceleration(): void; + /** + * Enables mixed sandbox mode on the app. This method can only be called before app + * is ready. + */ + enableMixedSandbox(): void; /** * Exits immediately with exitCode. exitCode defaults to 0. All windows will be * closed immediately without asking user and the before-quit and will-quit events @@ -552,20 +565,21 @@ declare namespace Electron { * This method makes your application a Single Instance Application - instead of * allowing multiple instances of your app to run, this will ensure that only a * single instance of your app is running, and other instances signal this instance - * and exit. callback will be called with callback(argv, workingDirectory) when a - * second instance has been executed. argv is an Array of the second instance's - * command line arguments, and workingDirectory is its current working directory. - * Usually applications respond to this by making their primary window focused and - * non-minimized. The callback is guaranteed to be executed after the ready event - * of app gets emitted. This method returns false if your process is the primary - * instance of the application and your app should continue loading. And returns - * true if your process has sent its parameters to another instance, and you should - * immediately quit. On macOS the system enforces single instance automatically - * when users try to open a second instance of your app in Finder, and the - * open-file and open-url events will be emitted for that. However when users start - * your app in command line the system's single instance mechanism will be bypassed - * and you have to use this method to ensure single instance. An example of - * activating the window of primary instance when a second instance starts: + * and exit. callback will be called by the first instance with callback(argv, + * workingDirectory) when a second instance has been executed. argv is an Array of + * the second instance's command line arguments, and workingDirectory is its + * current working directory. Usually applications respond to this by making their + * primary window focused and non-minimized. The callback is guaranteed to be + * executed after the ready event of app gets emitted. This method returns false if + * your process is the primary instance of the application and your app should + * continue loading. And returns true if your process has sent its parameters to + * another instance, and you should immediately quit. On macOS the system enforces + * single instance automatically when users try to open a second instance of your + * app in Finder, and the open-file and open-url events will be emitted for that. + * However when users start your app in command line the system's single instance + * mechanism will be bypassed and you have to use this method to ensure single + * instance. An example of activating the window of primary instance when a second + * instance starts: */ makeSingleInstance(callback: (argv: string[], workingDirectory: string) => void): boolean; /** @@ -653,7 +667,7 @@ declare namespace Electron { * and pass arguments that specify your application name. For example: Note: This * API has no effect on MAS builds. */ - setLoginItemSettings(settings: Settings, path?: string, args?: string[]): void; + setLoginItemSettings(settings: Settings): void; /** * Overrides the current application's name. */ @@ -905,6 +919,13 @@ declare namespace Electron { once(event: 'moved', listener: Function): this; addListener(event: 'moved', listener: Function): this; removeListener(event: 'moved', listener: Function): this; + /** + * Emitted when the native new tab button is clicked. + */ + on(event: 'new-window-for-tab', listener: Function): this; + once(event: 'new-window-for-tab', listener: Function): this; + addListener(event: 'new-window-for-tab', listener: Function): this; + removeListener(event: 'new-window-for-tab', listener: Function): this; /** * Emitted when the document changed its title, calling event.preventDefault() will * prevent the native window's title from changing. @@ -1996,11 +2017,11 @@ declare namespace Electron { */ getUploadToServer(): boolean; /** - * Set an extra parameter to set be sent with the crash report. The values - * specified here will be sent in addition to any values set via the extra option - * when start was called. This API is only available on macOS, if you need to - * add/update extra parameters on Linux and Windows after your first call to start - * you can call start again with the updated extra options. + * Set an extra parameter to be sent with the crash report. The values specified + * here will be sent in addition to any values set via the extra option when start + * was called. This API is only available on macOS, if you need to add/update extra + * parameters on Linux and Windows after your first call to start you can call + * start again with the updated extra options. */ setExtraParameter(key: string, value: string): void; /** @@ -2611,7 +2632,7 @@ declare namespace Electron { * event.returnValue. Note: Sending a synchronous message will block the whole * renderer process, unless you know what you are doing you should never use it. */ - sendSync(channel: string, ...args: any[]): void; + sendSync(channel: string, ...args: any[]): any; /** * Like ipcRenderer.send but the event will be sent to the element in the * host page instead of the main process. @@ -2690,6 +2711,7 @@ declare namespace Electron { /** * The maximum amount of memory that has ever been pinned to actual physical RAM. + * On macOS its value will always be 0. */ peakWorkingSetSize: number; /** @@ -2874,6 +2896,26 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/notification + on(event: 'action', listener: (event: Event, + /** + * The index of the action that was activated + */ + index: number) => void): this; + once(event: 'action', listener: (event: Event, + /** + * The index of the action that was activated + */ + index: number) => void): this; + addListener(event: 'action', listener: (event: Event, + /** + * The index of the action that was activated + */ + index: number) => void): this; + removeListener(event: 'action', listener: (event: Event, + /** + * The index of the action that was activated + */ + index: number) => void): this; /** * Emitted when the notification is clicked by the user. */ @@ -2934,6 +2976,20 @@ declare namespace Electron { show(): void; } + interface NotificationAction { + + // Docs: http://electron.atom.io/docs/api/structures/notification-action + + /** + * The label for the given action. + */ + text?: string; + /** + * The type of action, can be button. + */ + type: ('button'); + } + interface Point { // Docs: http://electron.atom.io/docs/api/structures/point @@ -3130,14 +3186,20 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/structures/rectangle + /** + * The height of the rectangle (must be an integer) + */ height: number; + /** + * The width of the rectangle (must be an integer) + */ width: number; /** - * The x coordinate of the origin of the rectangle + * The x coordinate of the origin of the rectangle (must be an integer) */ x: number; /** - * The y coordinate of the origin of the rectangle + * The y coordinate of the origin of the rectangle (must be an integer) */ y: number; } @@ -3913,6 +3975,52 @@ declare namespace Electron { * the dropped text string */ text: string) => void): this; + /** + * Emitted when the mouse enters the tray icon. + */ + on(event: 'mouse-enter', listener: (event: Event, + /** + * The position of the event + */ + position: Point) => void): this; + once(event: 'mouse-enter', listener: (event: Event, + /** + * The position of the event + */ + position: Point) => void): this; + addListener(event: 'mouse-enter', listener: (event: Event, + /** + * The position of the event + */ + position: Point) => void): this; + removeListener(event: 'mouse-enter', listener: (event: Event, + /** + * The position of the event + */ + position: Point) => void): this; + /** + * Emitted when the mouse exits the tray icon. + */ + on(event: 'mouse-leave', listener: (event: Event, + /** + * The position of the event + */ + position: Point) => void): this; + once(event: 'mouse-leave', listener: (event: Event, + /** + * The position of the event + */ + position: Point) => void): this; + addListener(event: 'mouse-leave', listener: (event: Event, + /** + * The position of the event + */ + position: Point) => void): this; + removeListener(event: 'mouse-leave', listener: (event: Event, + /** + * The position of the event + */ + position: Point) => void): this; /** * Emitted when the tray icon is right clicked. */ @@ -4091,8 +4199,8 @@ declare namespace Electron { static getFocusedWebContents(): WebContents; /** * Emitted before dispatching the keydown and keyup events in the page. Calling - * event.preventDefault will prevent the page keydown/keyup events from being - * dispatched. + * event.preventDefault will prevent the page keydown/keyup events and the menu + * shortcuts. To only prevent the menu shortcuts, use setIgnoreMenuShortcuts: */ on(event: 'before-input-event', listener: (event: Event, /** @@ -4814,13 +4922,13 @@ declare namespace Electron { * called with callback(image). The image is an instance of NativeImage that stores * data of the snapshot. Omitting rect will capture the whole visible page. */ - capturePage(callback: (image: NativeImage) => void): void; + capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; /** * Captures a snapshot of the page within rect. Upon completion callback will be * called with callback(image). The image is an instance of NativeImage that stores * data of the snapshot. Omitting rect will capture the whole visible page. */ - capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; + capturePage(callback: (image: NativeImage) => void): void; /** * Clears the navigation history. */ @@ -4877,6 +4985,10 @@ declare namespace Electron { * request can be obtained by subscribing to found-in-page event. */ findInPage(text: string, options?: FindInPageOptions): void; + /** + * Focuses the web page. + */ + focus(): void; getFrameRate(): number; getOSProcessId(): number; /** @@ -5040,6 +5152,10 @@ declare namespace Electron { * Only values between 1 and 60 are accepted. */ setFrameRate(fps: number): void; + /** + * Ignore application menu shortcuts while this web contents is focused. + */ + setIgnoreMenuShortcuts(ignore: boolean): void; /** * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level. */ @@ -6034,7 +6150,9 @@ declare namespace Electron { zoomToPageWidth?: boolean; /** * Tab group name, allows opening the window as a native tab on macOS 10.12+. - * Windows with the same tabbing identifier will be grouped together. + * Windows with the same tabbing identifier will be grouped together. This also + * adds a native new tab button to your window's tab bar and allows your app and + * window to receive the new-window-for-tab event. */ tabbingIdentifier?: string; /** @@ -6067,16 +6185,16 @@ declare namespace Electron { /** * Should follow window.location.origin’s representation scheme://host:port. */ - origin: string; + origin?: string; /** * The types of storages to clear, can contain: appcache, cookies, filesystem, * indexdb, localstorage, shadercache, websql, serviceworkers */ - storages: string[]; + storages?: string[]; /** * The types of quotas to clear, can contain: temporary, persistent, syncable. */ - quotas: string[]; + quotas?: string[]; } interface CommandLine { @@ -6216,7 +6334,8 @@ declare namespace Electron { ignoreSystemCrashHandler?: boolean; /** * An object you can define that will be sent along with the report. Only string - * properties are sent correctly. Nested objects are not supported. + * properties are sent correctly. Nested objects are not supported and the property + * names and values must be less than 64 characters long. */ extra?: Extra; } @@ -6827,6 +6946,11 @@ declare namespace Electron { * The placeholder to write in the inline reply input field. */ replyPlaceholder?: string; + /** + * Actions to add to the notification. Please read the available actions and + * limitations in the NotificationAction documentation + */ + actions: NotificationAction[]; } interface OnBeforeRedirectDetails { @@ -7085,11 +7209,11 @@ declare namespace Electron { /** * Don't ask user for print settings. Default is false. */ - silent: boolean; + silent?: boolean; /** * Also prints the background color and image of the web page. Default is false. */ - printBackground: boolean; + printBackground?: boolean; /** * Set the printer device name to use. Default is ''. */ @@ -7292,6 +7416,9 @@ declare namespace Electron { interface SaveDialogOptions { title?: string; + /** + * Absolute directory path, absolute file path, or file name to use by default. + */ defaultPath?: string; /** * Custom label for the confirmation button, when left empty the default label will @@ -7326,6 +7453,15 @@ declare namespace Electron { * opened to know the current value. This setting is only supported on macOS. */ openAsHidden?: boolean; + /** + * The executable to launch at login. Defaults to process.execPath. + */ + path?: string; + /** + * The command-line arguments to pass to the executable. Defaults to an empty + * array. Take care to wrap paths in quotes. + */ + args?: string[]; } interface SizeOptions { @@ -7569,14 +7705,14 @@ declare namespace Electron { } interface Versions { - /** - * A String representing Electron's version string. - */ - electron?: string; /** * A String representing Chrome's version string. */ chrome?: string; + /** + * A String representing Electron's version string. + */ + electron?: string; } interface WillNavigateEvent extends Event { @@ -7966,10 +8102,36 @@ declare namespace NodeJS { * true will disable the support for asar archives in Node's built-in modules. */ noAsar?: boolean; + /** + * A Boolean that controls whether or not deprecation warnings are printed to + * stderr. Setting this to true will silence deprecation warnings. This property + * is used instead of the --no-deprecation command line flag. + */ + noDeprecation?: boolean; /** * A String representing the path to the resources directory. */ resourcesPath?: string; + /** + * A Boolean that controls whether or not deprecation warnings will be thrown as + * exceptions. Setting this to true will throw errors for deprecations. This + * property is used instead of the --throw-deprecation command line flag. + */ + throwDeprecation?: boolean; + /** + * A Boolean that controls whether or not deprecations printed to stderr include + * their stack trace. Setting this to true will print stack traces for + * deprecations. This property is instead of the --trace-deprecation command line + * flag. + */ + traceDeprecation?: boolean; + /** + * A Boolean that controls whether or not process warnings printed to stderr + * include their stack trace. Setting this to true will print stack traces for + * process warnings (including deprecations). This property is instead of the + * --trace-warnings command line flag. + */ + traceProcessWarnings?: boolean; /** * A String representing the current process's type, can be "browser" (i.e. main * process) or "renderer". From 21657c6289ee69f1ffb46508dd8ae75799b12292 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Wed, 28 Jun 2017 16:47:26 -0700 Subject: [PATCH 328/328] Update to Electron v1.7.4 --- npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/package.json b/npm/package.json index 01962cde7376..99ed50f7b2cf 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.7.3", + "version": "1.7.4", "description": "Install prebuilt electron binaries for the command-line using npm", "repository": "https://github.com/electron-userland/electron-prebuilt", "scripts": {