jjant / elm-fps / Fps

This library allows you to easily compute minimum, maximum, and average FPS for your application.

Setup


type Model

init : Basics.Int -> Model

Initializes the model, takes an integer representing how many frames we consider for the average FPS.

Usually, 20 is a good number to perceive regular variations in FPS.


type Msg

update : Msg -> Model -> Model

Update the state when a new frame time is received.

subscriptions : Platform.Sub.Sub Msg

Subscribes to animation frame to compute frame times.

View

fps : Model -> Maybe { average : Basics.Float, min : Basics.Float, max : Basics.Float }

Get FPS information.

Returns Nothing if no frame times have been received yet.