Skip to content

Commit c5c78ad

Browse files
committed
docs: update README for new semantics
1 parent b667786 commit c5c78ad

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

README.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@ for (const type of types) {
5959
}
6060
```
6161

62-
## `permissions.askForContactsAccess(callback)`
62+
## `permissions.askForContactsAccess()`
6363

64-
* `callback` Function
65-
* `status` String - Whether or not the request succeeded or failed; can be `authorized` or `denied`.
64+
Returns `Promise<String>` - Whether or not the request succeeded or failed; can be `authorized` or `denied`.
6665

6766
Your app’s `Info.plist` file must provide a value for the `NSContactsUsageDescription` key that explains to the user why your app is requesting Contacts access.
6867

@@ -71,41 +70,39 @@ Your app’s `Info.plist` file must provide a value for the `NSContactsUsageDesc
7170
<string>Your reason for wanting to access the Contact store</string>
7271
```
7372

74-
**Note:** `status` will be called back as `authorized` prior to macOS 10.11, as access to contacts was unilaterally allowed until that version.
73+
**Note:** `status` will be resolved back as `authorized` prior to macOS 10.11, as access to contacts was unilaterally allowed until that version.
7574

7675
Example:
7776
```js
7877
const { askForContactsAccess } = require('node-mac-permissions')
7978

80-
askForContactsAccess((status) => {
79+
askForContactsAccess().then(status => {
8180
console.log(`Access to Contacts is ${status}`)
8281
})
8382
```
8483

85-
## `permissions.askForCalendarAccess(callback)`
84+
## `permissions.askForCalendarAccess()`
8685

87-
* `callback` Function
88-
* `status` String - Whether or not the request succeeded or failed; can be `authorized` or `denied`.
86+
Returns `Promise<String>` - Whether or not the request succeeded or failed; can be `authorized` or `denied`.
8987

9088
Example:
9189
```js
9290
const { askForCalendarAccess } = require('node-mac-permissions')
9391

94-
askForCalendarAccess((status) => {
92+
askForCalendarAccess().then(status => {
9593
console.log(`Access to Calendar is ${status}`)
9694
})
9795
```
9896

99-
## `permissions.askForRemindersAccess(callback)`
97+
## `permissions.askForRemindersAccess()`
10098

101-
* `callback` Function
102-
* `status` String - Whether or not the request succeeded or failed; can be `authorized` or `denied`.
99+
Returns `Promise<String>` - Whether or not the request succeeded or failed; can be `authorized` or `denied`.
103100

104101
Example:
105102
```js
106103
const { askForRemindersAccess } = require('node-mac-permissions')
107104

108-
askForRemindersAccess((status) => {
105+
askForRemindersAccess().then(status => {
109106
console.log(`Access to Reminders is ${status}`)
110107
})
111108
```
@@ -121,12 +118,11 @@ const { askForFullDiskAccess } = require('node-mac-permissions')
121118
askForFullDiskAccess()
122119
```
123120

124-
## `permissions.askForMediaAccess(type, callback)`
121+
## `permissions.askForMediaAccess(type)`
125122

126123
* `type` String - The type of media to which you are requesting access. Can be `microphone` or `camera`.
127124

128-
* `callback` Function
129-
* `status` String - Whether or not the request succeeded or failed; can be `authorized` or `denied`.
125+
Returns `Promise<String>` - Whether or not the request succeeded or failed; can be `authorized` or `denied`.
130126

131127
Your app must provide an explanation for its use of capture devices using the `NSCameraUsageDescription` or `NSMicrophoneUsageDescription` `Info.plist` keys; Calling this method or attempting to start a capture session without a usage description raises an exception.
132128

@@ -137,14 +133,14 @@ Your app must provide an explanation for its use of capture devices using the `N
137133
<string>Your reason for wanting to access the Microphone</string>
138134
```
139135

140-
**Note:** `status` will be called back as `authorized` prior to macOS 10.14 High Sierra, as access to the camera and microphone was unilaterally allowed until that version.
136+
**Note:** `status` will be resolved back as `authorized` prior to macOS 10.14 High Sierra, as access to the camera and microphone was unilaterally allowed until that version.
141137

142138
Example:
143139
```js
144140
const { askForMediaAccess } = require('node-mac-permissions')
145141

146142
for (const type of ['microphone', 'camera']) {
147-
askForMediaAccess(type, (status) => {
143+
askForMediaAccess(type).then(status => {
148144
console.log(`Access to media type ${type} is ${status}`)
149145
})
150146
}

0 commit comments

Comments
 (0)