lue-bird / elm-state-interface / Web.Window

Observe and alter the page's global environment as part of an Interface

animationFrameListen : Web.Interface Time.Posix

An Interface for detecting when animation frames occur. This will be about 60 times per second, though 75, 120, and 144 are also widely used. To balance this out in your animation, the current time is provided each frame.

To get a delta, you could use Web.Time.posixRequest to get a start time and check with e.g. Duration.from how far you've progressed in the timeline.

Note: To improve performance and battery life, most browsers pause these notifications when the app is running in a background tab or a hidden <iframe>.

Replacement for Browser.Events.onAnimationFrame

Note: uses window.requestAnimationFrame.

visibilityChangeListen : Web.Interface Web.WindowVisibility

An Interface for detecting changes to the visibility to the user

You can use times where the page becomes hidden to for example pause a currently running game. These times will also be the last reliable observation you can make before a user might close the page, so treat it as the likely end of the user's session

sizeRequest : Web.Interface { width : Basics.Int, height : Basics.Int }

An Interface for getting the inner window width and height in pixels, not including toolbars/scrollbars

resizeListen : Web.Interface { width : Basics.Int, height : Basics.Int }

An Interface for detecting changes to the inner window width and height

preferredLanguagesRequest : Web.Interface (List String)

An Interface for reading the languages the user prefers. Each described using language tags according to RFC 5646: Tags for Identifying Languages (also known as BCP 47). In the returned list they are ordered by preference with the most preferred language first.

Note: uses window.navigator.languages

preferredLanguagesChangeListen : Web.Interface (List String)

An Interface for detecting changes to the languages the user prefers. Each described using language tags according to RFC 5646: Tags for Identifying Languages (also known as BCP 47). In the returned list they are ordered by preference with the most preferred language first.

Note: uses window.onlanguagechange

documentListenTo : String -> Web.Interface Json.Decode.Value

An Interface for detecting a specific document event that has no native Interface, like like scroll, scrollend, selectionchange or paste

titleReplaceBy : String -> Web.Interface future_

An Interface for setting the document's title

authorSet : String -> Web.Interface future_

An Interface for adding or replacing the document's author metadata

keywordsSet : List String -> Web.Interface future_

An Interface for adding or replacing the document's keywords metadata which should consist of words relevant to the page's content

descriptionSet : String -> Web.Interface future_

An Interface for adding or replacing the document's description metadata which should be a short and accurate summary of the content of the page. Several browsers, like Firefox and Opera, use this as the default description of bookmarked pages.