@@ -29,25 +29,24 @@ const open = require('opn');
29
29
30
30
// Opens the image in the default image viewer
31
31
(async () => {
32
- await open (' unicorn.png' );
33
-
32
+ await open (' unicorn.png' , {wait: true });
34
33
console .log (' The image viewer closed' );
35
- })();
36
34
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' );
39
37
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' });
42
40
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
+ })();
45
44
```
46
45
47
46
48
47
## API
49
48
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.
51
50
52
51
### opn(target, [ options] )
53
52
@@ -68,11 +67,11 @@ Type: `Object`
68
67
##### wait
69
68
70
69
Type: ` boolean ` <br >
71
- Default: ` true `
70
+ Default: ` false `
72
71
73
72
Wait for the opened app to exit before fulfilling the promise. If ` false ` it's fulfilled immediately when opening the app.
74
73
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.
76
75
77
76
##### app
78
77
0 commit comments