m3g4p0p / framus

Promise wrapper for requesting an animation frame

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

framus

Promise wrapper for requesting an animation frame.

Installation

yarn add framus

Usage

function framus(callback?: function, options?: object): Promise

Callback based

import { framus } from 'framus'

framus(now => {
  document.body.textContent = now
})

Promise based

;(async () => {
  document.body.textContent = await framus()
})()

With abort signal option

const controller = new AbortController()

framus({ signal: controller.signal }).catch(console.error)
controller.abort()

License

MIT 2019

About

Promise wrapper for requesting an animation frame

License:MIT License


Languages

Language:TypeScript 100.0%