refactor: make name a prop on app (#17701)

Update app.name to be a property on app.
This commit is contained in:
Shelley Vohr 2019-04-30 13:55:33 -07:00 committed by GitHub
parent f2d41b7812
commit 8d83518f9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 57 additions and 25 deletions

View file

@ -661,12 +661,16 @@ 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.
**[Deprecated Soon](modernization/property-updates.md)**
### `app.setName(name)`
* `name` String
Overrides the current application's name.
**[Deprecated Soon](modernization/property-updates.md)**
### `app.getLocale()`
Returns `String` - The current application locale. Possible return values are documented [here](locales.md).
@ -1366,3 +1370,12 @@ A `Boolean` property that returns `true` if the app is packaged, `false` otherw
[Squirrel-Windows]: https://github.com/Squirrel/Squirrel.Windows
[JumpListBeginListMSDN]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx
[about-panel-options]: https://developer.apple.com/reference/appkit/nsapplication/1428479-orderfrontstandardaboutpanelwith?language=objc
### `app.name`
A `String` property that indicates the current application's name, which is the name in the application's `package.json` file.
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.

View file

@ -1318,7 +1318,7 @@ 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`.
it will assume `{app.name}.desktop`.
On Windows, a mode can be passed. Accepted values are `none`, `normal`,
`indeterminate`, `error`, and `paused`. If you call `setProgressBar` without a

View file

@ -44,7 +44,7 @@ The `crashReporter` module has the following methods:
* `options` Object
* `companyName` String
* `submitURL` String - URL that crash reports will be sent to as POST.
* `productName` String (optional) - Defaults to `app.getName()`.
* `productName` String (optional) - Defaults to `app.name`.
* `uploadToServer` Boolean (optional) - Whether crash reports should be sent to the server
Default is `true`.
* `ignoreSystemCrashHandler` Boolean (optional) - Default is `false`.

View file

@ -155,7 +155,7 @@ const { app, Menu } = require('electron')
const template = [
// { role: 'appMenu' }
...(process.platform === 'darwin' ? [{
label: app.getName(),
label: app.name,
submenu: [
{ role: 'about' },
{ type: 'separator' },

View file

@ -5,7 +5,6 @@ The Electron team is currently undergoing an initiative to convert separate gett
## Candidates
* `app` module
* `name`
* `dock`
* `badge`
* `autoUpdater` module
@ -58,3 +57,4 @@ The Electron team is currently undergoing an initiative to convert separate gett
* `accessibilitySupport`
* `applicationMenu`
* `badgeCount`
* `name`