Skip to content

Commit

Permalink
chore(README.md): updating docs with latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
willmendesneto committed Nov 16, 2019
1 parent 3eb9fb3 commit 7490529
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased][]

### Updated

- Updating `README.md` docs with latest changes

## [1.6.0][] - 2019-11-14

### Updated
Expand Down Expand Up @@ -157,7 +161,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
[1.5.0]: https://github.com/willmendesneto/perf-marks/tree/v1.5.0
[unreleased]: https://github.com/willmendesneto/perf-marks/compare/v1.5.1...HEAD
[1.5.1]: https://github.com/willmendesneto/perf-marks/tree/v1.5.1


[Unreleased]: https://github.com/willmendesneto/perf-marks/compare/v1.6.0...HEAD
[1.6.0]: https://github.com/willmendesneto/perf-marks/tree/v1.6.0
[unreleased]: https://github.com/willmendesneto/perf-marks/compare/v1.6.0...HEAD
[1.6.0]: https://github.com/willmendesneto/perf-marks/tree/v1.6.0
39 changes: 25 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,28 @@ Try out our [demo on Stackblitz](https://perf-marks-playground.stackblitz.io)!

![Perf marks in action](./images/perf-marks-in-action.gif)

## Run the app
### Run the tests

```bash
$ yarn start
$ yarn test # run the tests
```

## Run the tests
### Run the build

```bash
$ yarn test # run the tests
$ yarn build # run the tests
```

## Run the build
### Run the bundlesize check

```bash
$ yarn build # run the tests
$ yarn bundlesize # run the tests
```

### Run the code lint

```bash
$ yarn lint # run the tests
```

## `PerfMarks`
Expand All @@ -103,7 +109,9 @@ PerfMarks.start('name-of-your-mark');

### `PerfMarks.end(markName)`

Returns the results for the specified marker
Returns the results for the specified marker.

> `PerfMarks.end(markName)` calls `PerfMarks.clear(markName)` after return the mark values
```js
import * as PerfMarks from 'perf-marks';
Expand Down Expand Up @@ -137,6 +145,7 @@ import * as PerfMarks from 'perf-marks';

...
PerfMarks.start('name-of-your-mark');
PerfMarks.start('another-name-of-your-mark');
...
PerfMarks.clearAll();
...
Expand Down Expand Up @@ -173,32 +182,34 @@ const markResult: PerfMarksPerformanceNavigationTiming[] = PerfMarks.getEntriesB

### `PerfMarks.isUserTimingAPISupported`

Boolean with the result of the check if User Timing API is supported for the current browser/NodeJS version
Boolean with the result of the check if User Timing API is supported for the current browser/NodeJS version.

> `PerfMarks` already have a fallback in case user timing is not supported. This boolean is exposed in case the app needs to check the case to use any other mechanism.
```js
import * as PerfMarks from 'perf-marks';

...
PerfMarks.start('name-of-your-mark');
PerfMarks.start('another-name-of-your-mark');
...
// It will return results for all the marks that matches with `name-of-your-mark`
// In this case, `name-of-your-mark` and `another-name-of-your-mark`
const markResult: PerfMarksPerformanceNavigationTiming[] = PerfMarks.getEntriesByType('name-of-your-mark');
if (PerfMarks.isUserTimingAPISupported) {
// ... Do something
}
...
```

## Entrypoints

These are entrypoints for specific components to be used carefully by the consumers. If you're using one of these entrypoints we are assuming you know what you are doing. So it means that code-splitting and tree-shaking should be done on the consumer/product side.

By definition it will use CJS as the main distribution entrypoint used in the app. However, this can be changed in the consumer's bundle step. This is the built-in scenario if the consumer uses toolings such as `Webpack`, `Rollup`, or `Parcel`.

### Exposed entrypoints

- `perf-marks/marks`: it has all the methods for marks
- `start`
- `end`
- `clear`
- `clearAll`
- `isUserTimingAPISupported`
- `perf-marks/entries`: it has all the methods to get entries
- `getNavigationMarker`
- `getEntriesByType`
Expand Down

0 comments on commit 7490529

Please sign in to comment.