forked from felixhao28/node-systray
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
81 lines (81 loc) · 2.1 KB
/
Copy pathindex.d.ts
File metadata and controls
81 lines (81 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/// <reference types="node" />
import * as child from 'child_process';
import * as readline from 'readline';
export interface MenuItem {
title: string;
tooltip: string;
checked?: boolean;
enabled?: boolean;
hidden?: boolean;
items?: MenuItem[];
icon?: string;
isTemplateIcon?: boolean;
}
export interface Menu {
icon: string;
title: string;
tooltip: string;
items: MenuItem[];
isTemplateIcon?: boolean;
}
export interface ClickEvent {
type: 'clicked';
item: MenuItem;
seq_id: number;
__id: number;
}
export interface ReadyEvent {
type: 'ready';
}
export declare type Event = ClickEvent | ReadyEvent;
export interface UpdateItemAction {
type: 'update-item';
item: MenuItem;
seq_id?: number;
}
export interface UpdateMenuAction {
type: 'update-menu';
menu: Menu;
}
export interface UpdateMenuAndItemAction {
type: 'update-menu-and-item';
menu: Menu;
item: MenuItem;
seq_id?: number;
}
export interface ExitAction {
type: 'exit';
}
export declare type Action = UpdateItemAction | UpdateMenuAction | UpdateMenuAndItemAction | ExitAction;
export interface Conf {
menu: Menu;
debug?: boolean;
copyDir?: boolean | string;
}
export default class SysTray {
static separator: MenuItem;
protected _conf: Conf;
private _process;
get process(): child.ChildProcess;
protected _rl: readline.ReadLine;
protected _binPath: string;
private _ready;
private internalIdMap;
constructor(conf: Conf);
private init;
ready(): Promise<void>;
onReady(listener: () => void): this;
onClick(listener: (action: ClickEvent) => void): Promise<this>;
private writeLine;
sendAction(action: Action): Promise<this>;
/**
* Kill the systray process
*
* @param exitNode Exit current node process after systray process is killed, default is true
*/
kill(exitNode?: boolean): Promise<void>;
onExit(listener: (code: number | null, signal: string | null) => void): void;
onError(listener: (err: Error) => void): void;
get killed(): boolean;
get binPath(): string;
}