Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

README

        

# @saber2pr/interval

> Interval use requestAnimationFrame.

```bash
npm install @saber2pr/interval
```

# API

```ts
const interval = new Interval() // delta is 16

const 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