Merge pull request #17854 from unindented/patch-1

Update types for auto-launch v5.0.1
This commit is contained in:
Ryan Cavanaugh
2017-07-10 10:28:30 -07:00
committed by GitHub
4 changed files with 59 additions and 53 deletions
+17 -18
View File
@@ -1,24 +1,23 @@
import AutoLaunch = require('auto-launch');
var a1 = new AutoLaunch({
name: 'Foo',
const minecraftAutoLauncher = new AutoLaunch({
name: 'Minecraft',
path: '/Applications/Minecraft.app',
mac: {
useLaunchAgent: true
}
});
var a2 = new AutoLaunch({
name: 'Foo',
path: '/Applications/Foo.app',
isHidden: true,
});
minecraftAutoLauncher.enable();
minecraftAutoLauncher.disable();
a1.enable();
a2.disable();
a1.isEnabled(function(enabled: boolean) {
if (enabled) {
return;
minecraftAutoLauncher.isEnabled()
.then((isEnabled) => {
if (isEnabled) {
return;
}
a1.enable(function(err){ console.log(err.message); });
});
minecraftAutoLauncher.enable();
})
.catch((err) => {
console.error(err);
});
+39 -33
View File
@@ -1,41 +1,47 @@
// Type definitions for auto-launch 0.1.18
// Type definitions for auto-launch 5.0
// Project: https://github.com/Teamwork/node-auto-launch
// Definitions by: rhysd <https://github.com/rhysd>
// Definitions by: rhysd <https://github.com/rhysd>, Daniel Perez Alvarez <https://github.com/unindented>
// Definitions: https://github.com/DefinitelyTyped/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;
interface AutoLaunchOptions {
/**
* Application name.
*/
name: string;
/**
* Path to application. Default is `process.execPath`.
*/
path?: string;
/**
* Hidden on launch. Default is `false`.
*/
isHidden?: boolean;
/**
* For Mac-only options.
*/
mac?: {
/**
* By default, AppleScript is used to add a Login Item. If this is `true`, Launch Agent will be used to auto-launch your app. Defaults is `false`.
*/
useLaunchAgent?: boolean;
};
}
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: (enabled: boolean) => void): void;
constructor(options: AutoLaunchOptions);
/**
* Enables auto-launch at start up.
*/
enable(): Promise<void>;
/**
* Disables auto-launch at start up.
*/
disable(): Promise<void>;
/**
* Returns true if auto-launch is enabled.
*/
isEnabled(): Promise<boolean>;
}
declare module "auto-launch" {
var al: typeof AutoLaunch;
export = al;
}
export = AutoLaunch;
+2 -2
View File
@@ -7,7 +7,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -20,4 +20,4 @@
"index.d.ts",
"auto-launch-tests.ts"
]
}
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }