ghcjs-base-0.2.0.0: base library for GHCJS

Safe HaskellNone
LanguageHaskell98

JavaScript.Web.AnimationFrame

Description

Animation frames are the browser's mechanism for smooth animation. An animation frame callback is run just before the browser repaints.

When the content window is inactive, for example when the user is looking at another tab, it can take a long time for an animation frame callback to happen. Be careful structuring evaluation around this! Typically this means carefully forcing the data before the animation frame is requested, so the callback can run quickly and predictably.

Synopsis

Documentation

waitForAnimationFrame :: IO Double Source #

Wait for an animation frame callback to continue running the current thread. Use synchronously if the thread should not be preempted. This will return the high-performance clock time stamp once an animation frame is reached.

inAnimationFrame Source #

Arguments

:: OnBlocked

what to do when encountering a blocking call

-> (Double -> IO ())

the action to run

-> IO AnimationFrameHandle 

Run the action in an animationframe callback. The action runs in a synchronous thread, and is passed the high-performance clock time stamp for that frame.