Move getBadgeCount and setBadgeCount under app (#14882)

This commit is contained in:
Daniel Perez Alvarez
2017-02-26 19:01:24 -08:00
committed by Masahiro Wakame
parent 3ceff45bba
commit ad604728f7
2 changed files with 17 additions and 16 deletions

30
electron/index.d.ts vendored
View File

@@ -1,6 +1,6 @@
// Type definitions for Electron v1.4.8
// Project: http://electron.atom.io/
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>, aliib <https://github.com/aliib>
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>, aliib <https://github.com/aliib>, Daniel Perez Alvarez <https://github.com/unindented>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -398,6 +398,20 @@ declare namespace Electron {
* This method can only be called before app is ready.
*/
disableHardwareAcceleration(): void;
/**
* Sets the counter badge for current app. Setting the count to 0 will hide the badge.
*
* @returns True when the call succeeded, otherwise returns false.
*
* Note: This API is only available on macOS and Linux.
*/
setBadgeCount(count: number): boolean;
/**
* @returns The current value displayed in the counter badge.
*
* Note: This API is only available on macOS and Linux.
*/
getBadgeCount(): number;
/**
* @returns whether current desktop environment is Unity launcher. (Linux)
*
@@ -505,20 +519,6 @@ declare namespace Electron {
* Note: This API is only available on macOS.
*/
getBadge(): string;
/**
* Sets the counter badge for current app. Setting the count to 0 will hide the badge.
*
* @returns True when the call succeeded, otherwise returns false.
*
* Note: This API is only available on macOS and Linux.
*/
setBadgeCount(count: number): boolean;
/**
* @returns The current value displayed in the counter badge.
*
* Note: This API is only available on macOS and Linux.
*/
getBadgeCount(): number;
/**
* Hides the dock icon.
*

View File

@@ -232,7 +232,8 @@ app.dock.setBadge('foo');
var id = app.dock.bounce('informational');
app.dock.cancelBounce(id);
app.dock.setIcon('/path/to/icon.png');
app.dock.setBadgeCount(app.dock.getBadgeCount() + 1);
app.setBadgeCount(app.getBadgeCount() + 1);
app.setUserTasks([
<Electron.Task>{