Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saber2pr/interval
Interval use requestAnimationFrame.
https://github.com/saber2pr/interval
interval requestanimationframe typescript
Last synced: about 2 months ago
JSON representation
Interval use requestAnimationFrame.
- Host: GitHub
- URL: https://github.com/saber2pr/interval
- Owner: Saber2pr
- Created: 2019-01-02T12:52:01.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-07T06:36:34.000Z (over 5 years ago)
- Last Synced: 2024-10-30T10:37:23.499Z (2 months ago)
- Topics: interval, requestanimationframe, typescript
- Language: TypeScript
- Homepage:
- Size: 30.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @saber2pr/interval
> Interval use requestAnimationFrame.
```bash
npm install @saber2pr/interval
```# API
```ts
const interval = new Interval() // delta is 16const interval = new Interval(1000) // delta is 1000
```## Interval.push
```ts
const update1 = time => console.log('update1', time)
const update2 = time => console.log('update2', time)interval.push(update1, update2)
```## interval.remove
```ts
const update1 = time => console.log('update1', time)interval.remove(update1)
```## interval.setDelta
```ts
interval.setDelta(500) // delta is changed to 500
```## interval.execute
```ts
interval.execute() // interval is starting...
```## interval.cancel
```ts
interval.cancel() // interval is canceled.
```# Author
> saber2pr