# @gladeye/af

> Animation Frame class & instance with read and write cycles to maximise performance

Latest version **1.0.4** (published 2018-10-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @gladeye/af
pnpm add @gladeye/af
yarn add @gladeye/af
bun add @gladeye/af
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2018-10-11 |
| First published | 2018-09-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | William Hamlin |
| Maintainers | ben-sharp, chrislam, hazardu5, kenvunz, kethatril, williamhamlin |

## Links

- npm: https://www.npmjs.com/package/@gladeye/af
- Repository: https://github.com/gladeye/af
- Homepage: https://github.com/gladeye/af#readme
- Issues: https://github.com/gladeye/af/issues
- npm.io page: https://npm.io/package/@gladeye/af

## Recent versions

- 1.0.4 (latest) — 2018-10-11
- 1.0.3 — 2018-10-11
- 1.0.2 — 2018-09-18
- 1.0.1 — 2018-09-18
- 1.0.0 — 2018-09-18

## README

# AF

Simple animation frame class with read and write cycles to seperate out logic and draws to improve performance.

Reads will run before Writes.

## Installation

npm install @gladeye/af

## Use

As a singleton. This should be the main way this is used.
```js
import { af } from '@gladeye/af'; // lowercase af

let count = 0;

function update(){
    count ++;
}

const animFram = af();

animFram.addRead( update );

animFramf.removeRead( update );

```

Or you may extend the class.


```js
import { AF } from '@gladeye/af'; // uppercase AF

class ewAF extends AF{

}
```

## Methods

    - start()

    - stop()

    - addRead( fn )
        Adds function to the read cycle. These will run before the write functions

    - addWrite( fn )
        Adds function to the write cycle. These will run after the read functions

    - removeRead( fn )
        Removes function from the read cycle

    - removeWrite( fn )
        Removes function from the write cycle

    - onNextRead( fn )
        Adds function to run once on the next read cycle

    - onNextWrite( fn )
        Adds function to run once on the next write cycle

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