timing2
Version:
The state-of-art web performance metrics collector based on High Resolution Time API
52 lines (38 loc) • 1.35 kB
Markdown
timing2 [](https://travis-ci.com/debug-tips/timing2) [](http://badge.fury.io/js/timing2) [](https://coveralls.io/github/debug-tips/timing2?branch=master) [](https://www.npmjs.com/package/timing2)
------------
A [PerformanceTimeline](https://www.w3.org/TR/performance-timeline-2/) polyfill for legacy browsers.
## Usage
**module**
```bash
npm install --save timing2
```
```js
import timing2 from 'timing2';
timing2.getEntries();
timing2.getEntriesByName(name);
timing2.getEntriesByType('navigation');
timing2.now();
timing2.timeOrigin;
```
**standalone**
```html
<script src="https://unpkg.com/timing2@0.3.0/lib/timing2.js"></script>
<script>
timing2.getEntries();
timing2.getEntriesByName(name);
timing2.getEntriesByType('navigation');
timing2.now();
timing2.timeOrigin;
</script>
```
## API
The following methods and properties of `window.performance` is polyfilled:
- getEntries
- getEntriesByName
- getEntriesByType
- now
- timeOrigin
For legacy browsers, only `NavigationTiming` will be returned.
## ChangeLog
### v0.3.0
- make this project a polyfill