Skip to content

Commit

Permalink
chore(release): 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dmnsgn committed Aug 15, 2023
1 parent 049e740 commit 892cc80
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 27 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

# [3.0.0](https://github.com/dmnsgn/raf-perf/compare/v2.1.0...v3.0.0) (2023-08-15)


### Features

* removed "events" dependency ([a76c133](https://github.com/dmnsgn/raf-perf/commit/a76c133864d7797460161b32c8206f5b1119b0b3))
* replace events dependency with a simple emit/on Set emitter ([b4197b3](https://github.com/dmnsgn/raf-perf/commit/b4197b3b90f1ddbda78a6f020f576b65310b7383))


### BREAKING CHANGES

* RafPerf doesn't extends EventEmitter anymore



# [2.1.0](https://github.com/dmnsgn/raf-perf/compare/v2.0.0...v2.1.0) (2021-09-10)

Expand Down
82 changes: 59 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,23 @@ const destroy = () => {
<dd></dd>
</dl>

## Events

<dl>
<dt><a href="#event_perf">"perf"</a></dt>
<dd><p>Event triggered when performance ratio (<code>this.frameDuration / averageDeltaTime</code>) is updated. Understand a ratio of the fps, for instance for a fps value of 24, <code>ratio &lt; 0.5</code> means that the averaged <code>fps &lt; 12</code> and you should probably do something about it.</p>
</dd>
<dt><a href="#event_tick">"tick"</a></dt>
<dd><p>Event triggered on tick, throttled by <code>options.fps</code>.</p>
</dd>
</dl>

## Typedefs

<dl>
<dt><a href="#Options">Options</a> : <code>Object</code></dt>
<dt><a href="#Options">Options</a> : <code>object</code></dt>
<dd></dd>
<dt><a href="#OptionsPerformances">OptionsPerformances</a> : <code>Object</code></dt>
<dt><a href="#OptionsPerformances">OptionsPerformances</a> : <code>object</code></dt>
<dd></dd>
</dl>

Expand All @@ -96,11 +107,12 @@ const destroy = () => {

- [RafPerf](#RafPerf)
- [new RafPerf([options])](#new_RafPerf_new)
- [.TickEvent](#RafPerf+TickEvent) : <code>string</code>
- [.PerfEvent](#RafPerf+PerfEvent) : <code>string</code>
- [.start()](#RafPerf+start)
- [.tick()](#RafPerf+tick)
- [.stop()](#RafPerf+stop)
- ["perf"](#RafPerf+event_perf)
- ["tick"](#RafPerf+event_tick)
- [.on(type, cb)](#RafPerf+on) ⇒ <code>function</code>

<a name="new_RafPerf_new"></a>

Expand All @@ -112,47 +124,71 @@ Creates an instance of RafPerf.
| --------- | -------------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [options] | [<code>Options</code>](#Options) | <code>{}</code> | `samplesCount` and `sampleDuration` are used concurrently. Set `sampleDuration` to a _falsy_ value if you only want to sample performances from a number of frames. |

<a name="RafPerf+TickEvent"></a>

### rafPerf.TickEvent : <code>string</code>

**Kind**: instance property of [<code>RafPerf</code>](#RafPerf)
<a name="RafPerf+PerfEvent"></a>

### rafPerf.PerfEvent : <code>string</code>

**Kind**: instance property of [<code>RafPerf</code>](#RafPerf)
<a name="RafPerf+start"></a>

### rafPerf.start()

Run the `requestAnimationFrame` loop and start checking performances if `options.performances.enabled` is `true`.

**Kind**: instance method of [<code>RafPerf</code>](#RafPerf)
**Kind**: instance method of [<code>RafPerf</code>](#RafPerf)
<a name="RafPerf+tick"></a>

### rafPerf.tick()

The frame loop callback.

**Kind**: instance method of [<code>RafPerf</code>](#RafPerf)
**Emits**: [<code>perf</code>](#RafPerf+event_perf), [<code>tick</code>](#RafPerf+event_tick)
**Kind**: instance method of [<code>RafPerf</code>](#RafPerf)
**Emits**: <code>RafPerf.event:PerfEvent</code>, <code>RafPerf.event:TickEvent</code>
<a name="RafPerf+stop"></a>

### rafPerf.stop()

Run `cancelAnimationFrame` if necessary and reset the engine.

**Kind**: instance method of [<code>RafPerf</code>](#RafPerf)
<a name="RafPerf+event_perf"></a>
**Kind**: instance method of [<code>RafPerf</code>](#RafPerf)
<a name="RafPerf+on"></a>

### rafPerf.on(type, cb) ⇒ <code>function</code>

Add "perf" and "tick" listeners.

**Kind**: instance method of [<code>RafPerf</code>](#RafPerf)
**Returns**: <code>function</code> - Call the return value to unsubscribe.

| Param | Type |
| ----- | --------------------- |
| type | <code>string</code> |
| cb | <code>function</code> |

<a name="event_perf"></a>

### "perf"
## "perf"

Event triggered when performance ratio (`this.frameDuration / averageDeltaTime`) is updated. Understand a ratio of the fps, for instance for a fps value of 24, `ratio < 0.5` means that the averaged `fps < 12` and you should probably do something about it.

**Kind**: event emitted by [<code>RafPerf</code>](#RafPerf)
<a name="RafPerf+event_tick"></a>
**Kind**: event emitted
<a name="event_tick"></a>

### "tick"
## "tick"

Event triggered on tick, throttled by `options.fps`.

**Kind**: event emitted by [<code>RafPerf</code>](#RafPerf)
**Kind**: event emitted
<a name="Options"></a>

## Options : <code>Object</code>
## Options : <code>object</code>

**Kind**: global typedef
**Kind**: global typedef
**Properties**

| Name | Type | Default | Description |
Expand All @@ -162,16 +198,16 @@ Event triggered on tick, throttled by `options.fps`.

<a name="OptionsPerformances"></a>

## OptionsPerformances : <code>Object</code>
## OptionsPerformances : <code>object</code>

**Kind**: global typedef
**Kind**: global typedef
**Properties**

| Name | Type | Default | Description |
| ---------------- | -------------------- | ------------------ | -------------------------------------------- |
| [enabled] | <code>boolean</code> | <code>false</code> | Evaluate performances. |
| [samplesCount] | <code>number</code> | <code>200</code> | Number of samples to evaluate performances. |
| [sampleDuration] | <code>number</code> | <code>200</code> | Duration of sample to evaluate performances. |
| Name | Type | Default | Description |
| ---------------- | -------------------- | ----------------- | -------------------------------------------- |
| [enabled] | <code>boolean</code> | <code>true</code> | Evaluate performances. |
| [samplesCount] | <code>number</code> | <code>200</code> | Number of samples to evaluate performances. |
| [sampleDuration] | <code>number</code> | <code>4000</code> | Duration of sample to evaluate performances. |

<!-- api-end -->

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "raf-perf",
"version": "2.1.0",
"version": "3.0.0",
"description": "RAF loop with an adaptive fps and performance ratio calculated from either a sample count or a sample duration. Typically used when doing intensive graphics computation in canvas.",
"keywords": [
"raf",
Expand Down

0 comments on commit 892cc80

Please sign in to comment.