New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@most/animation-frame

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@most/animation-frame

[![Build Status](https://travis-ci.org/mostjs/x-animation-frame.svg?branch=master)](https://travis-ci.org/mostjs/x-animation-frame)

  • 0.1.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Weekly downloads
 
Created
Source

Build Status

EXPERIMENTAL This is an experimental package.

@most/animation-frame

Create a stream of animation frames.

Get it

npm i @most/animation-frame --save

yarn add @most/animation-frame

Types

export type DOMHighResTimeStamp = number

export type AnimationFrameHandler = DOMHighResTimeStamp => void

export type AnimationFrameRequest = number

export type AnimationFrames = {
  requestAnimationFrame: AnimationFrameHandler => AnimationFrameRequest,
  cancelAnimationFrame: AnimationFrameRequest => void
}

Note that window satisfies the AnimationFrames type, so you can pass window to the API methods below.

API

nextAnimationFrame :: AnimationFrames → Stream DOMHighResTimeStamp

Create a stream containing only the next animation frame.

animationFrames :: AnimationFrames → Stream DOMHighResTimeStamp

Create an infinite stream containing all future animation frames. This can be used to efficiently update a UI on each animation frame. Use take, until, etc. to make the stream finite if you need.

import { animationFrames } from '@most/animation-frame'
import { tap, sample, runEffects } from '@most/core'
import { newDefaultScheduler } from '@most/scheduler'

const afs = animationFrames(window)
const applicationUpdates = createApplicationUpdatesStream()

// Sample updates at each animationFrame and render the UI
const render = tap(renderUpdates, sample(applicationUpdates, afs))

runEffects(render, newDefaultScheduler())

FAQs

Package last updated on 19 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc