Add background option for macOS

This commit is contained in:
Sun Knudsen
2019-04-07 07:33:49 -04:00
parent 935a7078dd
commit fee60a7ddc
2 changed files with 11 additions and 2 deletions

11
types/open/index.d.ts vendored
View File

@@ -1,9 +1,10 @@
// Type definitions for open 6.0
// Type definitions for open 6.1
// Project: https://github.com/sindresorhus/open
// Definitions by: Shinnosuke Watanabe <https://github.com/shinnn>,
// Maxime LUCE <https://github.com/SomaticIT>,
// Tommy Lent <https://github.com/tlent>,
// Florian Keller <https://github.com/ffflorian>
// Florian Keller <https://github.com/ffflorian>,
// Sun Knudsen <https://github.com/sunknudsen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -40,6 +41,12 @@ declare namespace Open {
*/
wait?: boolean;
/**
* Do not bring the app to the foreground (macOS only).
* Defaults to `false`.
*/
background?: boolean;
/**
* Specify the app to open the `target` with, or an array with the app and app arguments.
* The app name is platform dependent. Don't hard code it in reusable modules.

View File

@@ -5,4 +5,6 @@ open('foo'); // $ExpectType Promise<ChildProcess>
open('foo', { app: 'bar' }); // $ExpectType Promise<ChildProcess>
open('foo', { app: ['bar', '--arg'] }); // $ExpectType Promise<ChildProcess>
open('foo', { app: 'bar', wait: false }); // $ExpectType Promise<ChildProcess>
open('foo', { app: 'bar', background: false }); // $ExpectType Promise<ChildProcess>
open('foo', { app: ['bar', '--arg'], wait: false }); // $ExpectType Promise<ChildProcess>
open('foo', { app: ['bar', '--arg'], background: false }); // $ExpectType Promise<ChildProcess>