Selaa lähdekoodia

Improve request type doc

Mathieu Acthernoene 5 vuotta sitten
vanhempi
commit
f3d950098d
1 muutettua tiedostoa jossa 26 lisäystä ja 22 poistoa
  1. 26
    22
      README.md

+ 26
- 22
README.md Näytä tiedosto

@@ -174,34 +174,16 @@ IOS_PERMISSIONS.STOREKIT;
174 174
 
175 175
 ### Methods
176 176
 
177
-*types used in usage examples*
177
+_types used in usage examples_
178 178
 
179
-```ts  
180
-type Permission =
181
-  | keyof ANDROID_PERMISSIONS
182
-  | keyof IOS_PERMISSIONS
179
+```ts
180
+type Permission = keyof ANDROID_PERMISSIONS | keyof IOS_PERMISSIONS;
183 181
 
184 182
 type PermissionStatus =
185 183
   | "granted"
186 184
   | "denied"
187 185
   | "never_ask_again"
188 186
   | "unavailable";
189
-
190
-type NotificationOption =
191
-  | "badge"
192
-  | "sound"
193
-  | "alert"
194
-  | "carPlay"
195
-  | "criticalAlert"
196
-  | "provisional";
197
-
198
-type Rationale = {
199
-  title: string;
200
-  message: string;
201
-  buttonPositive: string;
202
-  buttonNegative?: string;
203
-  buttonNeutral?: string;
204
-};
205 187
 ```
206 188
 
207 189
 #### check()
@@ -272,7 +254,29 @@ Request one permission.
272 254
 #### Method type
273 255
 
274 256
 ```ts
275
-function request(permission: string, config: RequestConfig = {}): Promise<PermissionStatus>;
257
+type NotificationOption =
258
+  | "badge"
259
+  | "sound"
260
+  | "alert"
261
+  | "carPlay"
262
+  | "criticalAlert"
263
+  | "provisional";
264
+
265
+type Rationale = {
266
+  title: string;
267
+  message: string;
268
+  buttonPositive: string;
269
+  buttonNegative?: string;
270
+  buttonNeutral?: string;
271
+};
272
+
273
+function request(
274
+  permission: string,
275
+  config: {
276
+    notificationOptions?: NotificationOption[];
277
+    rationale?: Rationale;
278
+  } = {},
279
+): Promise<PermissionStatus>;
276 280
 ```
277 281
 
278 282
 #### Usage example