reflex-dom-contrib-0.4.1: A playground for experimenting with infrastructure and common code for reflex applications

Safe HaskellNone
LanguageHaskell2010

Reflex.Dom.Contrib.Utils

Description

Misc reflex-dom helper functions.

Synopsis

Documentation

alertEvent :: MonadWidget t m => (a -> String) -> Event t a -> m () Source

Convenient function that pops up a javascript alert dialog box when an event fires with a message to display.

js_alert :: JSString -> IO () Source

confirmEvent :: MonadWidget t m => (a -> String) -> Event t a -> m (Event t a) Source

Convenient function that pops up a javascript confirmation dialog box when an event fires with a message to display.

js_confirm :: JSString -> IO Bool Source

getWindowLocationPath :: Window -> IO String Source

Gets the current path of the DOM Window (i.e., the contents of the address bar after the host, beginning with a "/"). https://developer.mozilla.org/en-US/docs/Web/API/Location

windowHistoryPushState :: String -> IO () Source

Pushes a new URL to the window history.

widgetHoldHelper :: MonadWidget t m => (a -> m b) -> a -> Event t a -> m (Dynamic t b) Source

A common form for widgetHold calls that mirrors the pattern seen in hold and holdDyn.

putDebugLn :: MonadWidget t m => String -> m () Source

Simple debug function that prints a message on postBuild.

putDebugLnE :: MonadWidget t m => Event t a -> (a -> String) -> m () Source

Prints a string when an event fires. This differs slightly from traceEvent because it will print even if the event is otherwise unused.

listWithKeyAndSelection :: forall t m k v a. (MonadWidget t m, Ord k) => Dynamic t k -> Dynamic t (Map k v) -> (k -> Dynamic t v -> Dynamic t Bool -> m a) -> m (Dynamic t (Map k a)) Source

A generalized version of the one in reflex-dom.

waitUntilJust :: IO (Maybe a) -> IO a Source

Simple utility function to robustly get things like the current window, DOM document, document body, etc.