Skip to content

Commit

Permalink
✨ add typescript type declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-runge committed Dec 15, 2023
1 parent c8c5dc8 commit 31346a2
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
49 changes: 49 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { EventEmitter } from 'events';

export interface TrayOptions {
title?: string;
icon?: Buffer;
debug?: boolean;
action?: Function;
useTempDir?: boolean | "clean";
}

export interface ItemOptions {
action?: Function;
label?: string;
disabled?: boolean;
checked?: boolean;
bold?: boolean;
type?: string;
}

export interface NotifyOptions {
title?: string;
msg?: string;
timeout?: number;
style?: 'info' | 'warn' | 'error';
}

export class Tray extends EventEmitter {
constructor(opts?: TrayOptions);
static create(opts?: TrayOptions, ready?: Function): Promise<Tray>;
setTitle(title: string): void;
setIcon(icon: Buffer): void;
setAction(action: Function): void;
notify(title: string, msg: string, action?: Function): void;
setMenu(...items: Item[]): void;
asXML(): string;
kill(): void;
separator(): Item;
item(label: string, props?: ItemOptions): Item;
}

export class Item {
constructor(label: string, props?: ItemOptions);
add(...items: Item[]): void;
asXML(): string;
}

export function create(opts?: TrayOptions, ready?: Function): Promise<Tray>;

export default { create: Tray.create }
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.2.2",
"description": "",
"main": "index.js",
"typings": "index.d.ts",
"directories": {
"example": "examples"
},
Expand Down

0 comments on commit 31346a2

Please sign in to comment.