Skip to content

Commit 2ad5346

Browse files
authored
chore(crashlytics): clean up readme table (#219)
* chore(crashlytics): clean up readme table * Update README.md
1 parent 6ad2a3c commit 2ad5346

File tree

1 file changed

+61
-63
lines changed

1 file changed

+61
-63
lines changed

packages/firebase-crashlytics/README.md

Lines changed: 61 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
21
# @nativescript/firebase-crashlytics
32

4-
* [Intro](#Intro)
5-
* [Installation](#Installation)
6-
* [Use @nativescript/firebase-crashlytics](#use-nativescriptfirebase-crashlytics)
7-
* [Log a crash context](#log-a-crash-context)
8-
* [Set crash attributes for more context data](#set-crash-attributes-for-more-context-data)
9-
* [Test crashlytics](#test-crashlytics)
10-
* [Report errors manually](#report-errors-manually)
11-
* [Manually enable or disable crashlytics collection](#manually-enable-or-disable-crashlytics-collection
12-
* [API](#API)
13-
* [Crashlytics](#Crashlytics)
14-
* [Properties](#Properties)
15-
* [Methods](#Methods)
16-
* [License](#License)
17-
3+
- [Intro](#Intro)
4+
- [Installation](#Installation)
5+
- [Use @nativescript/firebase-crashlytics](#use-nativescriptfirebase-crashlytics)
6+
- [Log a crash context](#log-a-crash-context)
7+
- [Set crash attributes for more context data](#set-crash-attributes-for-more-context-data)
8+
- [Test crashlytics](#test-crashlytics)
9+
- [Report errors manually](#report-errors-manually)
10+
- [Manually enable or disable crashlytics collection](#manually-enable-or-disable-crashlytics-collection
11+
- [API](#API)
12+
- [Crashlytics](#Crashlytics)
13+
- [Properties](#Properties)
14+
- [Methods](#Methods)
15+
- [License](#License)
1816

1917
A plugin that allows you to add [Firebase Crashlytics](https://firebase.google.com/docs/crashlytics) to your NativeScript app.
2018

@@ -28,21 +26,19 @@ Crashlytics helps you to collect analytics and details about crashes and errors
2826

2927
[![image](https://img.youtube.com/vi/k_mdNRZzd30/hqdefault.jpg)](https://www.youtube.com/watch?v=k_mdNRZzd30)
3028

31-
32-
## Installation
29+
## Installation
3330

3431
Install the plugin by running the following command in the root directory of your project.
3532

3633
```cli
3734
npm install @nativescript/firebase-crashlytics
3835
```
3936

37+
## Use @nativescript/firebase-crashlytics
4038

41-
## Use @nativescript/firebase-crashlytics
42-
43-
### Log a crash context
39+
### Log a crash context
4440

45-
Use the `log` method throughout your app to accumulate extra context for possible crashes that can happen.
41+
Use the `log` method throughout your app to accumulate extra context for possible crashes that can happen.
4642

4743
```ts
4844
import { firebase } from '@nativescript/firebase-core';
@@ -54,7 +50,7 @@ crashlytics.log('User signed in.');
5450

5551
### Set crash attributes for more context data
5652

57-
For additional context, Crashlytics also offers various methods to set attributes for the crash report.
53+
For additional context, Crashlytics also offers various methods to set attributes for the crash report.
5854

5955
- To set a single attribute, call the `setAttribute` method passing it the attribute name as the first argument and its value as the second argument.
6056

@@ -65,8 +61,8 @@ import '@nativescript/firebase-crashlytics'; // only needs to be imported 1x
6561
const crashlytics = firebase().crashlytics();
6662

6763
crashlytics().setAttribute('credits', String(user.credits));
68-
6964
```
65+
7066
- To set multiple attributes at once, call the `setAttributes` method with an object containing the attributes.
7167

7268
```ts
@@ -76,15 +72,17 @@ import '@nativescript/firebase-crashlytics'; // only needs to be imported 1x
7672
const crashlytics = firebase().crashlytics();
7773

7874
crashlytics().setAttributes({
79-
role: 'admin',
80-
followers: '13',
81-
email: user.email,
82-
username: user.username,
75+
role: 'admin',
76+
followers: '13',
77+
email: user.email,
78+
username: user.username,
8379
});
8480
```
81+
8582
You can use set methods to set predefined attributes, but you can also set your own custom attributes.
8683

87-
- You can also set the user ID. To do that call the `setUserId` method on `firebase().crashlytics()`
84+
- You can also set the user ID. To do that call the `setUserId` method on `firebase().crashlytics()`
85+
8886
```ts
8987
import { firebase } from '@nativescript/firebase-core';
9088
import '@nativescript/firebase-crashlytics'; // only needs to be imported 1x
@@ -94,17 +92,17 @@ const crashlytics = firebase().crashlytics();
9492
crashlytics.setUserId(user.uid);
9593
```
9694

97-
### Test crashlytics
95+
### Test crashlytics
9896

9997
To test Crashlytics for your app, call the `crash` method to force a crash and in Firebase Console, see if the crash is logged.
10098

10199
```ts
102-
firebase().crashlytics().crash()
100+
firebase().crashlytics().crash();
103101
```
104102

105-
### Report errors manually
103+
### Report errors manually
106104

107-
Crashlytics also supports sending JavaScript stack traces to the Firebase console. This can be used in any situation where an error occurs but is caught by your code to recover gracefully.
105+
Crashlytics also supports sending JavaScript stack traces to the Firebase console. This can be used in any situation where an error occurs but is caught by your code to recover gracefully.
108106

109107
To send a stack trace, pass a JavaScript Error to the `recordError` method.
110108

@@ -116,18 +114,18 @@ import { firebase } from '@nativescript/firebase-core';
116114
firebase().crashlytics().log('Updating user count.');
117115

118116
try {
119-
if (users) {
120-
someMethodToCatch();
121-
}
117+
if (users) {
118+
someMethodToCatch();
119+
}
122120
} catch (error) {
123-
crashlytics().recordError(error);
124-
console.log(error);
121+
crashlytics().recordError(error);
122+
console.log(error);
125123
}
126124
```
127125

128-
### Manually enable or disable crashlytics collection
126+
### Manually enable or disable crashlytics collection
129127

130-
As Crashlytics will be sending certain information regarding the user, users may want to opt out of the crash reporting. To disable crashlytics collection, call the `setCrashlyticsCollectionEnabled` method on `firebase().crashlytics()` passing it `false` This can be done throughout the app with a simple method call to setCrashlyticsCollectionEnabled:
128+
As Crashlytics will be sending certain information regarding the user, users may want to opt out of the crash reporting. To disable crashlytics collection, call the `setCrashlyticsCollectionEnabled` method on `firebase().crashlytics()` passing it `false` This can be done throughout the app with a simple method call to setCrashlyticsCollectionEnabled:
131129

132130
```ts
133131
import { firebase } from '@nativescript/firebase-core';
@@ -137,33 +135,33 @@ firebase().crashlytics().setCrashlyticsCollectionEnabled(false);
137135

138136
## API
139137

140-
### Crashlytics
138+
### Crashlytics
141139

142140
The Crashlytics class has the following members.
143141

144-
#### Properties
145-
146-
| Property | Type | Description
147-
|----------|------|------------
148-
| `ios` | | _readonly_
149-
| `android` | _readonly_
150-
| `app` | [FirebaseApp]()| _readonly_
151-
152-
#### Methods
153-
154-
| Method | Returns | Description
155-
|----------|------|------------
156-
| `checkForUnsentReports()` | `Promise<boolean>`
157-
| `crash()` | `void`
158-
| `deleteUnsentReports()` | `
159-
| `didCrashOnPreviousExecution()` | `boolean`
160-
| `log(message: string)` | `void`
161-
| `recordError(error: any)` | `void`
162-
| `sendUnsentReports()` | `void`
163-
| `setAttribute(name: string, value: string | number | boolean)` | `void`
164-
| `setAttributes(attributes: { [key: string]: string | number | boolean })` | `void`
165-
| `setCrashlyticsCollectionEnabled(enabled: boolean)` | `void`
166-
| `setUserId(userId: string)` | `void`
142+
#### Properties
143+
144+
| Property | Type | Description |
145+
| --------- | --------------- | ----------- |
146+
| `ios` | | _readonly_ |
147+
| `android` | _readonly_ |
148+
| `app` | [FirebaseApp]() | _readonly_ |
149+
150+
#### Methods
151+
152+
| Method | Returns | Description |
153+
| --------------------------------------------------------------------------- | ------------------ | ----------- |
154+
| `checkForUnsentReports()` | `Promise<boolean>` | |
155+
| `crash()` | `void` | |
156+
| `deleteUnsentReports()` | `void` | |
157+
| `didCrashOnPreviousExecution()` | `boolean` | |
158+
| `log(message: string)` | `void` | |
159+
| `recordError(error: any)` | `void` | |
160+
| `sendUnsentReports()` | `void` | |
161+
| `setAttribute(name: string, value: string \| number \| boolean)` | `void` | |
162+
| `setAttributes(attributes: { [key: string]: string \| number \| boolean })` | `void` | |
163+
| `setCrashlyticsCollectionEnabled(enabled: boolean)` | `void` | |
164+
| `setUserId(userId: string)` | `void` | |
167165

168166
## License
169167

0 commit comments

Comments
 (0)