https://github.com/gre/deprecated-qanimationframe
DEPRECATED just use requestAnimationFrame– Promisified requestAnimationFrame with Q
https://github.com/gre/deprecated-qanimationframe
Last synced: 11 months ago
JSON representation
DEPRECATED just use requestAnimationFrame– Promisified requestAnimationFrame with Q
- Host: GitHub
- URL: https://github.com/gre/deprecated-qanimationframe
- Owner: gre
- License: mit
- Created: 2013-07-06T13:42:37.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2015-02-20T10:46:00.000Z (over 11 years ago)
- Last Synced: 2025-07-09T04:19:24.278Z (12 months ago)
- Language: JavaScript
- Homepage: https://npmjs.org/package/qanimationframe
- Size: 441 KB
- Stars: 7
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**DEPRECATED** in favor of `raf`.
QanimationFrame
===
A simple Promise wrapper for `requestAnimationFrame` based on [Q](https://github.com/kriskowal/q).
This library intends to promisify requestAnimationFrame.
[Checkout the Annotated Source Code](http://gre.github.io/qanimationframe/docs/qanimationframe.html)
Usage
---
`QanimationFrame` is a *function* which takes a *function* and returns a *promise* containing it's return value (after one frame).
**QanimationFrame(f: function) => DOM.Element**
### Basic example
```javascript
var elt = document.createElement("div");
elt.innerHTML = "Hello world";
window.document.body.appendChild(elt);
var doSomething = QanimationFrame(function () {
elt.style.width = '50px';
elt.style.height = '50px';
return elt;
});
doSomething.then(function (elt) {
// style changes are rendered
var boundingBox = elt.getBoundingClientRect(elt);
console.log(boundingBox.right - boundingBox.left);
});
```
Installation
---
via [npm](https://npmjs.org/package/qanimationframe).
```sh
npm install qanimationframe
```
via bower
```sh
bower install qanimationframe
```
Supported browsers
---
All browsers are supported (including IE).
Tests
---
[](https://saucelabs.com/u/qanimationframe)