From 6cad73d91bf6a8449f632dc8aa95fdab3afc615e Mon Sep 17 00:00:00 2001 From: Andre Eckardt Date: Tue, 26 Jul 2016 18:41:18 +0200 Subject: [PATCH 1/3] extends node-webkit Tray class with EventEmitter See https://github.com/nwjs/nw.js/wiki/Tray#events --- node-webkit/node-webkit.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-webkit/node-webkit.d.ts b/node-webkit/node-webkit.d.ts index 81129274dc..a6760c9949 100644 --- a/node-webkit/node-webkit.d.ts +++ b/node-webkit/node-webkit.d.ts @@ -199,7 +199,7 @@ declare module "nw.gui" { menu?: Menu; } - export class Tray implements TrayOption { + export class Tray extends EventEmitter implements TrayOption { constructor(option: TrayOption); title: string; tooltip: string; From 7e54d47ca06643829f57aceef341defb6f682e1b Mon Sep 17 00:00:00 2001 From: Andre Eckardt Date: Tue, 26 Jul 2016 18:42:08 +0200 Subject: [PATCH 2/3] extends node-webkit App class with EventEmitter See https://github.com/nwjs/nw.js/wiki/App#events --- node-webkit/node-webkit.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-webkit/node-webkit.d.ts b/node-webkit/node-webkit.d.ts index a6760c9949..3a9533875b 100644 --- a/node-webkit/node-webkit.d.ts +++ b/node-webkit/node-webkit.d.ts @@ -156,7 +156,7 @@ declare module "nw.gui" { eval(frame: HTMLIFrameElement, script: string): void; } - export interface App { + export interface App extends EventEmitter { argv: any; fullArgv: any; dataPath: string; From e7d4c9f7a5acc5a7dc9648de73b34e6ed15c0de8 Mon Sep 17 00:00:00 2001 From: Andre Eckardt Date: Tue, 26 Jul 2016 19:08:22 +0200 Subject: [PATCH 3/3] adds typings for trayballoon module --- trayballoon/trayballoon-tests.ts | 15 +++++++++++++++ trayballoon/trayballoon.d.ts | 17 +++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 trayballoon/trayballoon-tests.ts create mode 100644 trayballoon/trayballoon.d.ts diff --git a/trayballoon/trayballoon-tests.ts b/trayballoon/trayballoon-tests.ts new file mode 100644 index 0000000000..dab23777e0 --- /dev/null +++ b/trayballoon/trayballoon-tests.ts @@ -0,0 +1,15 @@ +/// + +import trayballoon = require( "trayballoon" ); + +function testTrayballoon() { + trayballoon( { + text: "text", + title: "title", + icon: "icon", + timeout: 5000, + wait: true + }, () => { + + } ); +} diff --git a/trayballoon/trayballoon.d.ts b/trayballoon/trayballoon.d.ts new file mode 100644 index 0000000000..c60ffed40b --- /dev/null +++ b/trayballoon/trayballoon.d.ts @@ -0,0 +1,17 @@ +// Type definitions for trayballoon +// Project: https://github.com/sindresorhus/trayballoon +// Definitions by: André Eckardt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare interface TrayballoonOptions { + text:string + title?:string + icon?:string + timeout?:number + wait?:boolean +} + +declare function trayballoonFn( opts:TrayballoonOptions, fn:Function ): void; +declare module "trayballoon" { + export = trayballoonFn; +} \ No newline at end of file