Skip to content

Commit

Permalink
fix: check if window.performance.mark is supported when used .start()…
Browse files Browse the repository at this point in the history
… or .end()
  • Loading branch information
Zizzamia committed Oct 15, 2019
1 parent f354448 commit e7ab19a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 3.0.1 (2019-10-14)

* **fix:** check if `window.performance.mark` is supported when used `.start()` or `.end()`

## 3.0.0 (2019-10-14)

* **feat:** added Navigation Timing [#83](https://github.com/Zizzamia/perfume.js/issues/83)
Expand All @@ -12,8 +16,8 @@
### Breaking Changes

* **refactor:** removed default Google Analytics support, instead analyticsTracker will be the default method to communicate with the backend.
* **refactor:** log, sendTiming and analyticsTrackerg gets one solo options object instead of the original arguments
* **refactor:** Dropped support for EmulatedPerformance
* **refactor:** `log`, `sendTiming` and `analyticsTracker` gets one solo options object instead of the original arguments
* **refactor:** Dropped support for **EmulatedPerformance**
* **feat:** Discard queued tasks if running them as microtasks isn't supported [#77](https://github.com/Zizzamia/perfume.js/pull/77)

## 3.0.0-rc.11 (2019-10-13)
Expand All @@ -26,11 +30,11 @@

## 3.0.0-rc.10 (2019-9-29)

* **feat:** added more flexibility for log, sendTiming and analyticsTracker arguments [#70](https://github.com/Zizzamia/perfume.js/issues/70)
* **feat:** added more flexibility for log, `sendTiming` and `analyticsTracker` arguments [#70](https://github.com/Zizzamia/perfume.js/issues/70)

### Breaking Changes

* **refactor:** log, sendTiming and analyticsTrackerg gets one solo options object instead of the original arguments
* **refactor:** `log`, `sendTiming` and `analyticsTracker` gets one solo options object instead of the original arguments

## 3.0.0-rc.5 (2019-9-26)

Expand Down
2 changes: 1 addition & 1 deletion README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img src="https://github.com/Zizzamia/perfume.js/blob/master/docs/src/assets/perfume-logo-v2-1-2.png" align="left" width="200" />
</a>

# [Perfume.js v3.0.0](http://perfumejs.com)
# [Perfume.js v3.0.1](http://perfumejs.com)

[![NPM version](https://badge.fury.io/js/perfume.js.svg)](https://www.npmjs.org/package/perfume.js) [![Build Status](https://travis-ci.org/Zizzamia/perfume.js.svg?branch=master)](https://travis-ci.org/Zizzamia/perfume.js) [![NPM Downloads](http://img.shields.io/npm/dm/perfume.js.svg)](https://www.npmjs.org/package/perfume.js) [![Test Coverage](https://api.codeclimate.com/v1/badges/f813d2f45b274d93b8c5/test_coverage)](https://codeclimate.com/github/Zizzamia/perfume.js/test_coverage) [![JS gzip size](https://img.badgesize.io/https://unpkg.com/perfume.js?compression=gzip&label=JS+gzip+size)](https://unpkg.com/perfume.js)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img src="https://github.com/Zizzamia/perfume.js/blob/master/docs/src/assets/perfume-logo-v2-1-2.png" align="left" width="200" />
</a>

# [Perfume.js v3.0.0](http://perfumejs.com)
# [Perfume.js v3.0.1](http://perfumejs.com)

[![NPM version](https://badge.fury.io/js/perfume.js.svg)](https://www.npmjs.org/package/perfume.js) [![Build Status](https://travis-ci.org/Zizzamia/perfume.js.svg?branch=master)](https://travis-ci.org/Zizzamia/perfume.js) [![NPM Downloads](http://img.shields.io/npm/dm/perfume.js.svg)](https://www.npmjs.org/package/perfume.js) [![Test Coverage](https://api.codeclimate.com/v1/badges/f813d2f45b274d93b8c5/test_coverage)](https://codeclimate.com/github/Zizzamia/perfume.js/test_coverage) [![JS gzip size](https://img.badgesize.io/https://unpkg.com/perfume.js?compression=gzip&label=JS+gzip+size)](https://unpkg.com/perfume.js)

Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docs",
"version": "3.0.0",
"version": "3.0.1",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "perfume.js",
"version": "3.0.0",
"version": "3.0.1",
"description": "JavaScript library that measures First (Contentful) Paint (FP/FCP) and First Input Delay (FID). Annotates components’ performance for Vanilla and Angular applications, into the DevTools timeline. Reports all the results to your favorite tracking tool.",
"keywords": [
"performance-metrics",
Expand Down
6 changes: 3 additions & 3 deletions src/perfume.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Perfume.js v3.0.0 (http://zizzamia.github.io/perfume)
* Perfume.js v3.0.1 (http://zizzamia.github.io/perfume)
* Copyright 2018 The Perfume Authors (https://github.com/Zizzamia/perfume.js/graphs/contributors)
* Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE)
* @license
Expand Down Expand Up @@ -173,7 +173,7 @@ export default class Perfume {
* Start performance measurement
*/
start(metricName: string): void {
if (!this.checkMetricName(metricName)) {
if (!this.checkMetricName(metricName) || !Performance.supported()) {
return;
}
if (this.metrics[metricName]) {
Expand All @@ -194,7 +194,7 @@ export default class Perfume {
* End performance measurement
*/
end(metricName: string): void | number {
if (!this.checkMetricName(metricName)) {
if (!this.checkMetricName(metricName) || !Performance.supported()) {
return;
}
const metric = this.metrics[metricName];
Expand Down

0 comments on commit e7ab19a

Please sign in to comment.