From b49efc4030dd0eed7929c738f316d3a541c185ef Mon Sep 17 00:00:00 2001 From: rhysd Date: Fri, 21 Aug 2015 00:55:57 +0900 Subject: [PATCH] Added definitions for auto-launch package Project page is here. https://github.com/Teamwork/node-auto-launch > Launch node-webkit apps at login (mac & windows) --- auto-launch/auto-launch-tests.ts | 17 +++++++++++++ auto-launch/auto-launch.d.ts | 41 ++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 auto-launch/auto-launch-tests.ts create mode 100644 auto-launch/auto-launch.d.ts diff --git a/auto-launch/auto-launch-tests.ts b/auto-launch/auto-launch-tests.ts new file mode 100644 index 000000000..735985624 --- /dev/null +++ b/auto-launch/auto-launch-tests.ts @@ -0,0 +1,17 @@ +/// + +import AutoLaunch = require('auto-launch'); + +var a1 = new AutoLaunch({ + name: 'Foo', +}); + +var a2 = new AutoLaunch({ + name: 'Foo', + path: '/Applications/Foo.app', + isHidden: true, +}); + +a1.enable(); +a2.disable(); +var enabled: boolean = a1.isEnabled(); diff --git a/auto-launch/auto-launch.d.ts b/auto-launch/auto-launch.d.ts new file mode 100644 index 000000000..c208d10fd --- /dev/null +++ b/auto-launch/auto-launch.d.ts @@ -0,0 +1,41 @@ +// Type definitions for auto-launch 0.1.18 +// Project: https://github.com/Teamwork/node-auto-launch +// Definitions by: rhysd +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface AutoLaunchOption { + /** + * Application name. + */ + name: string; + /** + * Hidden on launch or not. Default is false. + */ + isHidden?: boolean; + /** + * Path to application directory. + * Default is process.execPath. + */ + path?: string; +} + +declare class AutoLaunch { + constructor(opts: AutoLaunchOption); + /** + * Enables to launch at start up + */ + enable(callback?: (err: Error) => void): void; + /** + * Disables to launch at start up + */ + disable(callback?: (err: Error) => void): void; + /** + * Returns if auto start up is enabled + */ + isEnabled(callback?: (err: Error) => void): boolean; +} + +declare module "auto-launch" { + var al: typeof AutoLaunch; + export = al; +}