qanimationframe

2.1.4 • Public • Published

DEPRECATED in favor of raf.

QanimationFrame

A simple Promise wrapper for requestAnimationFrame based on Q.

This library intends to promisify requestAnimationFrame.

Checkout the Annotated Source Code

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

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.

npm install qanimationframe

via bower

bower install qanimationframe

Supported browsers

All browsers are supported (including IE).

Tests

SauceLabs Status

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.1.4
    1,120
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.1.4
    1,120
  • 2.1.3
    2
  • 2.1.2
    15
  • 2.1.1
    3
  • 2.0.1
    2
  • 1.0.0
    2

Package Sidebar

Install

npm i qanimationframe

Weekly Downloads

548

Version

2.1.4

License

BSD

Last publish

Collaborators

  • gre