reflex-dom-retractable: Routing and retractable back button for reflex-dom

[ frp, gui, html, javascript, library, mit, reactive, reactivity, reflex, user-interface, user-interfaces, web ] [ Propose Tags ]

Library that automates widget switches and back button retract stack. See README.md


[Skip to Readme]
Versions [faq] 0.1.0.0, 0.1.3.0
Change log CHANGELOG.md
Dependencies base (>=4.7 && <4.13), containers (>=0.5 && <0.7), jsaddle (==0.9.*), mtl (>=2.1 && <2.3), ref-tf (==0.4.*), reflex (==0.6.*), reflex-dom (>=0.5 && <0.7) [details]
License MIT
Copyright 2019 ATUM SOLUTIONS AG
Author Anton Gushcha, Aminion, Vladimir Krutkin, Levon Oganyan
Maintainer Anton Gushcha <ncrashed@protonmail.com>, Vladimir Krutkin <krutkinvs@gmail.com>
Category Reflex, FRP, Web, GUI, HTML, Javascript, Reactive, Reactivity, User Interfaces, User-interface
Source repo head: git clone https://github.com/hexresearch/ergvein(retractable)
Uploaded by NCrashed at 2020-05-18T02:16:08Z
Distributions NixOS:0.1.3.0
Downloads 308 total (2 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs not available [build log]
All reported builds failed as of 2020-05-18 [all 2 reports]

Modules

  • Reflex
    • Dom
      • Reflex.Dom.Retractable
        • Reflex.Dom.Retractable.Class
        • Reflex.Dom.Retractable.Trans
          • Reflex.Dom.Retractable.Trans.Internal

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for reflex-dom-retractable-0.1.3.0

[back to package description]

Small library that implements "back" button feature for reflex-dom widgets. The core idea of the library is to have reusable widget that maintains history of switches and is decoupled from actual implementation of switching widgets.

The library doesn't use platform specific parts like connection to Android system back button or browser back button, but provides functions to bind them into your retractable frontend.

Example of usage:

import Control.Monad
import Reflex.Dom
import Reflex.Dom.Retractable

main :: IO ()
main = mainWidget $ runRetract frontend

frontend :: (MonadWidget t m, MonadRetract t m) => m ()
frontend = void $ retractStack $ pageA 42

pageA :: (MonadWidget t m, MonadRetract t m) => Int -> m ()
pageA n = do
   e <- button "Go page B"
   void $ nextWidget $ ffor e $ const Retractable {
       retractableNext = pageB $ n + 1
     , retractablePrev = Just $ pure $ pageA n
     }

pageB :: (MonadWidget t m, MonadRetract t m) => Int -> m ()
pageB n = do
  e <- button "Go page A"
  void $ nextWidget $ ffor e $ const  Retractable {
       retractableNext = pageA $ n + 1
     , retractablePrev = Just $ pure $ pageB n
     }