perfume.js
Advanced tools
Comparing version 0.2.0 to 0.2.1
var Perfume = /** @class */ (function () { | ||
function Perfume() { | ||
this.metrics = {}; | ||
this.logPrefix = "⚡️ Perfume.js: "; | ||
this.logPrefix = "⚡️ Perfume.js:"; | ||
if (!this.supportsPerfNow) { | ||
@@ -11,3 +11,3 @@ throw Error(this.logPrefix + " Cannot be used in this browser."); | ||
/** | ||
* True if the the browser supports the Navigation Timing API. | ||
* True if the browser supports the Navigation Timing API. | ||
* @type {boolean} | ||
@@ -23,3 +23,3 @@ */ | ||
/** | ||
* True if the the browser supports the User Timing API. | ||
* True if the browser supports the User Timing API. | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/Performance/mark | ||
@@ -36,3 +36,3 @@ * @type {boolean} | ||
* This assumes the user has made only one measurement for the given | ||
* name. Return the first one found. | ||
* name. Return the first PerformanceEntry objects for the given name. | ||
*/ | ||
@@ -83,3 +83,7 @@ Perfume.prototype.getMeasurementForGivenName = function (metricName) { | ||
} | ||
this.metrics[metricName].start = performance.now(); | ||
this.metrics[metricName] = { | ||
duration: 0, | ||
end: 0, | ||
start: performance.now(), | ||
}; | ||
if (this.supportsPerfMark) { | ||
@@ -86,0 +90,0 @@ performance.mark("mark_" + metricName + "_start"); |
@@ -6,3 +6,3 @@ "use strict"; | ||
this.metrics = {}; | ||
this.logPrefix = "⚡️ Perfume.js: "; | ||
this.logPrefix = "⚡️ Perfume.js:"; | ||
if (!this.supportsPerfNow) { | ||
@@ -14,3 +14,3 @@ throw Error(this.logPrefix + " Cannot be used in this browser."); | ||
/** | ||
* True if the the browser supports the Navigation Timing API. | ||
* True if the browser supports the Navigation Timing API. | ||
* @type {boolean} | ||
@@ -26,3 +26,3 @@ */ | ||
/** | ||
* True if the the browser supports the User Timing API. | ||
* True if the browser supports the User Timing API. | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/Performance/mark | ||
@@ -39,3 +39,3 @@ * @type {boolean} | ||
* This assumes the user has made only one measurement for the given | ||
* name. Return the first one found. | ||
* name. Return the first PerformanceEntry objects for the given name. | ||
*/ | ||
@@ -86,3 +86,7 @@ Perfume.prototype.getMeasurementForGivenName = function (metricName) { | ||
} | ||
this.metrics[metricName].start = performance.now(); | ||
this.metrics[metricName] = { | ||
duration: 0, | ||
end: 0, | ||
start: performance.now(), | ||
}; | ||
if (this.supportsPerfMark) { | ||
@@ -89,0 +93,0 @@ performance.mark("mark_" + metricName + "_start"); |
var Perfume = /** @class */ (function () { | ||
function Perfume() { | ||
this.metrics = {}; | ||
this.logPrefix = "⚡️ Perfume.js: "; | ||
this.logPrefix = "⚡️ Perfume.js:"; | ||
if (!this.supportsPerfNow) { | ||
@@ -11,3 +11,3 @@ throw Error(this.logPrefix + " Cannot be used in this browser."); | ||
/** | ||
* True if the the browser supports the Navigation Timing API. | ||
* True if the browser supports the Navigation Timing API. | ||
* @type {boolean} | ||
@@ -23,3 +23,3 @@ */ | ||
/** | ||
* True if the the browser supports the User Timing API. | ||
* True if the browser supports the User Timing API. | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/Performance/mark | ||
@@ -36,3 +36,3 @@ * @type {boolean} | ||
* This assumes the user has made only one measurement for the given | ||
* name. Return the first one found. | ||
* name. Return the first PerformanceEntry objects for the given name. | ||
*/ | ||
@@ -83,3 +83,7 @@ Perfume.prototype.getMeasurementForGivenName = function (metricName) { | ||
} | ||
this.metrics[metricName].start = performance.now(); | ||
this.metrics[metricName] = { | ||
duration: 0, | ||
end: 0, | ||
start: performance.now(), | ||
}; | ||
if (this.supportsPerfMark) { | ||
@@ -86,0 +90,0 @@ performance.mark("mark_" + metricName + "_start"); |
@@ -10,3 +10,3 @@ (function (global, factory) { | ||
this.metrics = {}; | ||
this.logPrefix = "⚡️ Perfume.js: "; | ||
this.logPrefix = "⚡️ Perfume.js:"; | ||
if (!this.supportsPerfNow) { | ||
@@ -18,3 +18,3 @@ throw Error(this.logPrefix + " Cannot be used in this browser."); | ||
/** | ||
* True if the the browser supports the Navigation Timing API. | ||
* True if the browser supports the Navigation Timing API. | ||
* @type {boolean} | ||
@@ -30,3 +30,3 @@ */ | ||
/** | ||
* True if the the browser supports the User Timing API. | ||
* True if the browser supports the User Timing API. | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/Performance/mark | ||
@@ -43,3 +43,3 @@ * @type {boolean} | ||
* This assumes the user has made only one measurement for the given | ||
* name. Return the first one found. | ||
* name. Return the first PerformanceEntry objects for the given name. | ||
*/ | ||
@@ -90,3 +90,7 @@ Perfume.prototype.getMeasurementForGivenName = function (metricName) { | ||
} | ||
this.metrics[metricName].start = performance.now(); | ||
this.metrics[metricName] = { | ||
duration: 0, | ||
end: 0, | ||
start: performance.now(), | ||
}; | ||
if (this.supportsPerfMark) { | ||
@@ -93,0 +97,0 @@ performance.mark("mark_" + metricName + "_start"); |
@@ -6,3 +6,3 @@ export default class Perfume { | ||
/** | ||
* True if the the browser supports the Navigation Timing API. | ||
* True if the browser supports the Navigation Timing API. | ||
* @type {boolean} | ||
@@ -12,3 +12,3 @@ */ | ||
/** | ||
* True if the the browser supports the User Timing API. | ||
* True if the browser supports the User Timing API. | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/Performance/mark | ||
@@ -20,3 +20,3 @@ * @type {boolean} | ||
* This assumes the user has made only one measurement for the given | ||
* name. Return the first one found. | ||
* name. Return the first PerformanceEntry objects for the given name. | ||
*/ | ||
@@ -23,0 +23,0 @@ getMeasurementForGivenName(metricName: string): any; |
{ | ||
"name": "perfume.js", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "", | ||
@@ -73,6 +73,6 @@ "keywords": [], | ||
"global": { | ||
"branches": 10, | ||
"functions": 15, | ||
"lines": 15, | ||
"statements": 15 | ||
"branches": 45, | ||
"functions": 82, | ||
"lines": 70, | ||
"statements": 70 | ||
} | ||
@@ -79,0 +79,0 @@ }, |
@@ -1,3 +0,3 @@ | ||
# Perfume.js v0.2.0 | ||
[![NPM version](https://badge.fury.io/js/perfume.js.svg)](https://www.npmjs.org/package/perfume.js) [![NPM Downloads](http://img.shields.io/npm/dm/ng-tasty.svg)](https://www.npmjs.org/package/ng-tasty) [![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) | ||
# Perfume.js v0.2.1 | ||
[![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) | ||
@@ -11,3 +11,3 @@ > Perfume is a tiny JavaScript library for measuring Short/Long Script, First Meaningful Paint, TTI (Time to Interactivity), annotating them to the DevTools timeline and reporting the results to Google Analytics. | ||
npm install --save-dev perfume.js | ||
npm install perfume.js --save | ||
@@ -22,3 +22,3 @@ | ||
```javascript | ||
import Perfume from 'perfume' | ||
import Perfume from 'perfume.js'; | ||
``` | ||
@@ -29,9 +29,19 @@ | ||
```javascript | ||
import Perfume from 'perfume/dist/es/perfume' | ||
import Perfume from 'node_modules/perfume.js/dist/es/perfume'; | ||
``` | ||
Universal Module Definition | ||
```javascript | ||
import Perfume from 'node_modules/perfume.js/perfume.umd.js'; | ||
``` | ||
### Start measuring | ||
#### First Meaningful Paint | ||
Page load is a key aspect of how a user perceives the performance of your page. See Measure Performance with the [RAIL Method](https://developers.google.com/web/fundamentals/performance/rail) for more information. | ||
```javascript | ||
const perfume = new Perfume(); | ||
perfume.firstPaint(); // ⚡️ Perfume.js: firstPaint 1604 ms | ||
``` | ||
@@ -38,0 +48,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51000
13
659
70