https://github.com/hustcc/page-fps
:framed_picture: Inject fps indicator into your page for web performance.
https://github.com/hustcc/page-fps
benchmark fps perf
Last synced: 3 months ago
JSON representation
:framed_picture: Inject fps indicator into your page for web performance.
- Host: GitHub
- URL: https://github.com/hustcc/page-fps
- Owner: hustcc
- License: mit
- Created: 2019-04-09T06:17:14.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-27T01:50:41.000Z (about 6 years ago)
- Last Synced: 2025-03-17T07:51:27.025Z (3 months ago)
- Topics: benchmark, fps, perf
- Language: TypeScript
- Homepage: https://git.hust.cc/page-fps/
- Size: 13.7 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# page-fps
> Inject fps indicator into your page.
[](https://www.npmjs.com/package/page-fps)
[](https://www.npmjs.com/package/page-fps)
[](https://unpkg.com/page-fps/dist/pf.min.js)## Install
> npm i --save page-fps
## Usage
- Code usage
```js
import PF from 'page-fps';const pf = new PF();
// start
pf.start();// stop
pf.stop();
```- Script usage
Just import `dist/entry.min.js` into your document with script tag.
## API
```ts
import PF from 'page-fps';
import { FPS, Timer } from 'page-fps'
```- `PF`: page fps indicator.
- `FPS`: a fps collector.
```ts
import { FPS } from 'page-fps';const fps = new FPS();
// 开始记录数据
fps.start();// 计算当前 fps
const f = fps.sample();// 停止记录数据
fps.stop();
```- `Timer`: a callback execute timer.
```ts
import { Timer } from 'page-fps';const timer = new Timer(callback, 30);
// 每隔 30ms 执行一次 callback 方法
timer.start();// 停止
timer.stop();
```## License
MIT