Skip to content

Commit da2d663

Browse files
committed
Make the wait option false by default
Fixes #91 Fixes #92
1 parent b30220c commit da2d663

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = async (target, options) => {
2020
}
2121

2222
options = {
23-
wait: true,
23+
wait: false,
2424
...options
2525
};
2626

readme.md

+11-12
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,24 @@ const open = require('opn');
2929

3030
// Opens the image in the default image viewer
3131
(async () => {
32-
await open('unicorn.png');
33-
32+
await open('unicorn.png', {wait: true});
3433
console.log('The image viewer closed');
35-
})();
3634

37-
// Opens the url in the default browser
38-
open('http://sindresorhus.com');
35+
// Opens the url in the default browser
36+
await open('http://sindresorhus.com');
3937

40-
// Specify the app to open in
41-
open('http://sindresorhus.com', {app: 'firefox'});
38+
// Specify the app to open in
39+
await open('http://sindresorhus.com', {app: 'firefox'});
4240

43-
// Specify app arguments
44-
open('http://sindresorhus.com', {app: ['google chrome', '--incognito']});
41+
// Specify app arguments
42+
await open('http://sindresorhus.com', {app: ['google chrome', '--incognito']});
43+
})();
4544
```
4645

4746

4847
## API
4948

50-
Uses the command `open` on macOS, `start` on Windows and `xdg-open` on other platforms.
49+
It uses the command `open` on macOS, `start` on Windows and `xdg-open` on other platforms.
5150

5251
### opn(target, [options])
5352

@@ -68,11 +67,11 @@ Type: `Object`
6867
##### wait
6968

7069
Type: `boolean`<br>
71-
Default: `true`
70+
Default: `false`
7271

7372
Wait for the opened app to exit before fulfilling the promise. If `false` it's fulfilled immediately when opening the app.
7473

75-
On Windows you have to explicitly specify an app for it to be able to wait.
74+
On Windows, you have to explicitly specify an app for it to be able to wait.
7675

7776
##### app
7877

test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ test('open file in default app', async () => {
2929
await open('index.js');
3030
});
3131

32-
test('not wait for the app to close if wait: false', async () => {
33-
await open('http://sindresorhus.com', {wait: false});
32+
test('wait for the app to close if wait: true', async () => {
33+
await open('http://sindresorhus.com', {wait: true});
3434
});
3535

3636
test('open url in default app', async () => {

0 commit comments

Comments
 (0)