https://github.com/choojs/on-performance
Listen for performance timeline events
https://github.com/choojs/on-performance
Last synced: 12 months ago
JSON representation
Listen for performance timeline events
- Host: GitHub
- URL: https://github.com/choojs/on-performance
- Owner: choojs
- License: mit
- Created: 2017-06-17T02:00:46.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-11T07:37:42.000Z (about 8 years ago)
- Last Synced: 2025-06-08T22:39:42.486Z (about 1 year ago)
- Language: JavaScript
- Size: 17.6 KB
- Stars: 26
- Watchers: 2
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# on-performance [![stability][0]][1]
[![npm version][2]][3] [![build status][4]][5]
[![downloads][8]][9] [![js-standard-style][10]][11]
Listen for performance timeline events and clears them after usage. Returns a
singleton. Can be used in both node and browser environments.
## Usage
```js
var onPerformance = require('on-performance')
onPerformance(function (entry) {
console.log('entry: ', entry.entryType, entry)
})
```
## API
### `stop = onPerformance(callback(entry))`
Listen for performance events. Returns a singleton (e.g. multiple calls to this
method are registered on the same listener). If multiple instances are created
during the first tick, all initial events will be played back to all instances.
### `stop()`
Stop the observer.
## License
[MIT](https://tldrlegal.com/license/mit-license)
[0]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square
[1]: https://nodejs.org/api/documentation.html#documentation_stability_index
[2]: https://img.shields.io/npm/v/on-performance.svg?style=flat-square
[3]: https://npmjs.org/package/on-performance
[4]: https://img.shields.io/travis/choojs/on-performance/master.svg?style=flat-square
[5]: https://travis-ci.org/choojs/on-performance
[6]: https://img.shields.io/codecov/c/github/choojs/on-performance/master.svg?style=flat-square
[7]: https://codecov.io/github/choojs/on-performance
[8]: http://img.shields.io/npm/dm/on-performance.svg?style=flat-square
[9]: https://npmjs.org/package/on-performance
[10]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[11]: https://github.com/feross/standard