File tree Expand file tree Collapse file tree 2 files changed +3
-7
lines changed Expand file tree Collapse file tree 2 files changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -19,16 +19,12 @@ function getAuthStatus(type) {
19
19
return permissions . getAuthStatus . call ( this , type )
20
20
}
21
21
22
- function askForMediaAccess ( type , callback ) {
22
+ function askForMediaAccess ( type ) {
23
23
if ( ! [ 'microphone' , 'camera' ] . includes ( type ) ) {
24
24
throw new TypeError ( `${ type } must be either 'camera' or 'microphone'` )
25
25
}
26
26
27
- if ( typeof callback !== 'function' ) {
28
- throw new TypeError ( `callback must be a function` )
29
- }
30
-
31
- return permissions . askForMediaAccess . call ( this , type , callback )
27
+ return permissions . askForMediaAccess . call ( this , type )
32
28
}
33
29
34
30
module . exports = {
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ describe('node-mac-permissions', () => {
35
35
describe ( 'askForMediaAccess(type, callback)' , ( ) => {
36
36
it ( 'throws on invalid media types' , ( ) => {
37
37
expect ( ( ) => {
38
- askForMediaAccess ( 'bad-type' , ( status ) => {
38
+ askForMediaAccess ( 'bad-type' ) . then ( status => {
39
39
console . log ( status )
40
40
} )
41
41
} ) . to . throw ( / b a d - t y p e m u s t b e e i t h e r ' c a m e r a ' o r ' m i c r o p h o n e ' / )
You can’t perform that action at this time.
0 commit comments