# frame-duration

> A lib for calculating the duration of frame dynamically, based on requestAnimationFrame, default is 1000 / 30. The actual duration will be calculated after 15 frames.

Latest version **1.1.0** (published 2020-05-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install frame-duration
pnpm add frame-duration
yarn add frame-duration
bun add frame-duration
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2020-05-01 |
| First published | 2020-05-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | 2631541504@qq.com |
| Maintainers | livelybone |
| Keywords | frame duration, frame, duration, dynamic, browser, nodejs |

## Links

- npm: https://www.npmjs.com/package/frame-duration
- Repository: https://github.com/livelybone/frame-duration
- Homepage: https://github.com/livelybone/frame-duration#readme
- Issues: https://github.com/livelybone/frame-duration/issues
- npm.io page: https://npm.io/package/frame-duration

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2020-05-01
- 1.0.1 — 2020-05-01
- 1.0.0 — 2020-05-01

## README

# frame-duration
[![NPM Version](http://img.shields.io/npm/v/frame-duration.svg?style=flat-square)](https://www.npmjs.com/package/frame-duration)
[![Download Month](http://img.shields.io/npm/dm/frame-duration.svg?style=flat-square)](https://www.npmjs.com/package/frame-duration)
![gzip with dependencies: 0.5kb](https://img.shields.io/badge/gzip--with--dependencies-0.5kb-brightgreen.svg "gzip with dependencies: 0.5kb")
![typescript](https://img.shields.io/badge/typescript-supported-blue.svg "typescript")

[中文文档](./README-CN.md)

A lib for calculating the duration of frame dynamically, based on requestAnimationFrame, default is 1000 / 30. The actual duration will be calculated after 15 frames.

## repository
https://github.com/livelybone/frame-duration.git

## Demo
https://github.com/livelybone/frame-duration#readme

## Run Example
you can see the usage by run the example of the module, here is the step:

1. Clone the library `git clone https://github.com/livelybone/frame-duration.git`
2. Go to the directory `cd your-module-directory`
3. Install npm dependencies `npm i`(use taobao registry: `npm i --registry=http://registry.npm.taobao.org`)
4. Open service `npm run dev`
5. See the example(usually is `http://127.0.0.1:3000/examples/test.html`) in your browser

## Installation
```bash
npm i -S frame-duration
```

## Global name - The variable the module exported in `umd` bundle
`FrameDuration`

## Interface
See what method or params you can use in [index.d.ts](./index.d.ts)

## Usage
```js
import FrameDuration from 'frame-duration'

console.log(FrameDuration.duration) // -> 33.33

// Set default duration. Make sure that this only run at the start of app
FrameDuration.duration = 1000 / 60

// Duration after dynamic calculate
setTimeout(() => {
  console.log(FrameDuration.duration) // -> 16.66
}, 1000)
```

Use in html, see what you can use in [CDN: unpkg](https://unpkg.com/frame-duration/lib/umd/)
```html
<-- use what you want -->
<script src="https://unpkg.com/frame-duration/lib/umd/<--module-->.js"></script>
```

Or，see what you can use in [CDN: jsdelivr](https://cdn.jsdelivr.net/npm/frame-duration/lib/umd/)
```html
<script src="https://cdn.jsdelivr.net/npm/frame-duration/lib/umd/<--module-->.js"></script>
```

---
_Source: https://npm.io/package/frame-duration · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
