JSPM

qanimationframe

2.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 384
  • Score
    100M100P100Q88710F
  • License BSD

Promisified requestAnimationFrame with Q

Package Exports

  • qanimationframe

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (qanimationframe) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

QanimationFrame

A simple Promise wrapper for requestAnimationFrame based on Q.

This library intends to wait for one DOM update (frame) for computing some code requiring a DOM frame update.

Checkout the Annotated Source Code

Usage

QanimationFrame is a function which takes a function and returns a DOM Element (after one frame).

QanimationFrame(f: function) => DOM.Element

Basic example

var elt = document.createElement("div");
elt.innerHTML = "Hello world";

var heightComputation = QanimationFrame(function () {
  return elt.offsetHeight;
});

heightComputation.then(function (height) {
  console.log("height="+height);
});

Installation

vai npm.

npm install qanimationframe

via bower

bower install qanimationframe

Supported browsers

All browsers are supported (including IE).

Tests

SauceLabs Status