Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Apr 5, 2019
1 parent 9c3cb55 commit d38954e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
6 changes: 4 additions & 2 deletions atom/browser/api/atom_api_app.cc
Expand Up @@ -1329,8 +1329,8 @@ void App::BuildPrototype(v8::Isolate* isolate,
base::Bind(&Browser::SetAsDefaultProtocolClient, browser))
.SetMethod("removeAsDefaultProtocolClient",
base::Bind(&Browser::RemoveAsDefaultProtocolClient, browser))
.SetMethod("setBadgeCount", base::Bind(&Browser::SetBadgeCount, browser))
.SetMethod("getBadgeCount", base::Bind(&Browser::GetBadgeCount, browser))
.SetMethod("_setBadgeCount", base::Bind(&Browser::SetBadgeCount, browser))
.SetMethod("_getBadgeCount", base::Bind(&Browser::GetBadgeCount, browser))
.SetMethod("getLoginItemSettings", &App::GetLoginItemSettings)
.SetMethod("setLoginItemSettings",
base::Bind(&Browser::SetLoginItemSettings, browser))
Expand All @@ -1356,6 +1356,8 @@ void App::BuildPrototype(v8::Isolate* isolate,
base::Bind(&Browser::SetAboutPanelOptions, browser))
.SetMethod("showAboutPanel",
base::Bind(&Browser::ShowAboutPanel, browser))
.SetProperty("badgeCount", base::Bind(&Browser::GetBadgeCount, browser),
base::Bind(&Browser::SetBadgeCount, browser))
#endif
#if defined(OS_MACOSX) || defined(OS_WIN)
.SetMethod("showEmojiPanel",
Expand Down
24 changes: 19 additions & 5 deletions docs/api/app.md
Expand Up @@ -1056,6 +1056,7 @@ gpuDevice:
machineModelName: 'MacBookPro',
machineModelVersion: '11.5' }
```

Using `basic` should be preferred if only basic information like `vendorId` or `driverId` is needed.

### `app.setBadgeCount(count)` _Linux_ _macOS_
Expand All @@ -1072,10 +1073,14 @@ On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
for more information please read [Desktop Environment Integration][unity-requirement].

**[Deprecated Soon](modernization/property-updates.md)**

### `app.getBadgeCount()` _Linux_ _macOS_

Returns `Integer` - The current value displayed in the counter badge.

**[Deprecated Soon](modernization/property-updates.md)**

### `app.isUnityRunning()` _Linux_

Returns `Boolean` - Whether the current desktop environment is Unity launcher.
Expand Down Expand Up @@ -1336,11 +1341,6 @@ Sets the `image` associated with this dock icon.

## Properties

### `app.applicationMenu`

A `Menu` property that return [`Menu`](menu.md) if one has been set and `null` otherwise.
Users can pass a [Menu](menu.md) to set this property.

### `app.accessibilitySupportEnabled` _macOS_ _Windows_

A `Boolean` property that's `true` if Chrome's accessibility support is enabled, `false` otherwise. This property will be `true` if the use of assistive technologies, such as screen readers, has been detected. Setting this property to `true` manually enables Chrome's accessibility support, allowing developers to expose accessibility switch to users in application settings.
Expand All @@ -1351,6 +1351,20 @@ This API must be called after the `ready` event is emitted.

**Note:** Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.

### `app.applicationMenu`

A `Menu` property that return [`Menu`](menu.md) if one has been set and `null` otherwise.
Users can pass a [Menu](menu.md) to set this property.

### `app.badgeCount` _Linux_ _macOS_

An `Integer` property that returns the badge count for current app. Setting the count to `0` will hide the badge.

On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.

**Note:** Unity launcher requires the existence of a `.desktop` file to work,
for more information please read [Desktop Environment Integration][unity-requirement].

### `app.isPackaged`

A `Boolean` property that returns `true` if the app is packaged, `false` otherwise. For many apps, this property can be used to distinguish development and production environments.
Expand Down
4 changes: 2 additions & 2 deletions docs/api/modernization/property-updates.md
Expand Up @@ -5,8 +5,6 @@ The Electron team is currently undergoing an initiative to convert separate gett
## Candidates

* `app` module
* `badgeCount`
* `name`
* `dock`
* `badge`
* `autoUpdater` module
Expand Down Expand Up @@ -58,3 +56,5 @@ The Electron team is currently undergoing an initiative to convert separate gett
* `app` module
* `accessibilitySupport`
* `applicationMenu`
* `badgeCount`
* `name`
1 change: 1 addition & 0 deletions lib/browser/api/app.ts
Expand Up @@ -79,6 +79,7 @@ app.getFileIcon = deprecate.promisify(app.getFileIcon)

// Property Deprecations
deprecate.fnToProperty(app, 'accessibilitySupportEnabled', '_isAccessibilitySupportEnabled', '_setAccessibilitySupportEnabled')
deprecate.fnToProperty(app, 'badgeCount', '_getBadgeCount', '_setBadgeCount')

// Wrappers for native classes.
const { DownloadItem } = process.electronBinding('download_item')
Expand Down

0 comments on commit d38954e

Please sign in to comment.