From 33b85b7f12798f5762d940ed5c30f775cdd7b751 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 28 Jan 2018 12:13:09 +0100 Subject: WIP --- client/src/Util/WaitFor.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 client/src/Util/WaitFor.hs (limited to 'client/src/Util/WaitFor.hs') diff --git a/client/src/Util/WaitFor.hs b/client/src/Util/WaitFor.hs new file mode 100644 index 0000000..0175c95 --- /dev/null +++ b/client/src/Util/WaitFor.hs @@ -0,0 +1,18 @@ +module Util.WaitFor + ( waitFor + ) where + +import Data.Time (NominalDiffTime) +import Reflex.Dom (Dynamic, Event, MonadWidget) +import qualified Reflex.Dom as R + +waitFor + :: forall t m a b. MonadWidget t m + => (Event t a -> m (Event t b)) + -> Event t () + -> Dynamic t a + -> m (Event t b, Event t Bool) +waitFor op start input = do + result <- op (R.tagPromptlyDyn input start) >>= R.debounce (0.5 :: NominalDiffTime) + let waiting = R.leftmost [ const True <$> start , const False <$> result ] + return (result, waiting) -- cgit v1.2.3 From 8a28f608d8e08fba4bbe54b46804d261686c3c03 Mon Sep 17 00:00:00 2001 From: Joris Date: Tue, 30 Oct 2018 20:33:17 +0100 Subject: Upgrade reflex-platform --- client/src/Util/WaitFor.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client/src/Util/WaitFor.hs') diff --git a/client/src/Util/WaitFor.hs b/client/src/Util/WaitFor.hs index 0175c95..7d5e7c5 100644 --- a/client/src/Util/WaitFor.hs +++ b/client/src/Util/WaitFor.hs @@ -13,6 +13,6 @@ waitFor -> Dynamic t a -> m (Event t b, Event t Bool) waitFor op start input = do - result <- op (R.tagPromptlyDyn input start) >>= R.debounce (0.5 :: NominalDiffTime) + result <- op (R.tag (R.current input) start) >>= R.debounce (0.5 :: NominalDiffTime) let waiting = R.leftmost [ const True <$> start , const False <$> result ] return (result, waiting) -- cgit v1.2.3 From b5244184920b4d7a8d64eada2eca21e9a6ea2df9 Mon Sep 17 00:00:00 2001 From: Joris Date: Tue, 30 Oct 2018 20:44:12 +0100 Subject: Use waitfor with delete confirm button --- client/src/Util/WaitFor.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'client/src/Util/WaitFor.hs') diff --git a/client/src/Util/WaitFor.hs b/client/src/Util/WaitFor.hs index 7d5e7c5..46882aa 100644 --- a/client/src/Util/WaitFor.hs +++ b/client/src/Util/WaitFor.hs @@ -9,10 +9,9 @@ import qualified Reflex.Dom as R waitFor :: forall t m a b. MonadWidget t m => (Event t a -> m (Event t b)) - -> Event t () - -> Dynamic t a + -> Event t a -> m (Event t b, Event t Bool) -waitFor op start input = do - result <- op (R.tag (R.current input) start) >>= R.debounce (0.5 :: NominalDiffTime) - let waiting = R.leftmost [ const True <$> start , const False <$> result ] +waitFor op input = do + result <- op input >>= R.debounce (0.2 :: NominalDiffTime) + let waiting = R.leftmost [ const True <$> input , const False <$> result ] return (result, waiting) -- cgit v1.2.3 From 86957359ecf54c205aee1c09e151172c327e987a Mon Sep 17 00:00:00 2001 From: Joris Date: Wed, 31 Oct 2018 19:03:19 +0100 Subject: Various fixes --- client/src/Util/WaitFor.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client/src/Util/WaitFor.hs') diff --git a/client/src/Util/WaitFor.hs b/client/src/Util/WaitFor.hs index 46882aa..02edff5 100644 --- a/client/src/Util/WaitFor.hs +++ b/client/src/Util/WaitFor.hs @@ -12,6 +12,6 @@ waitFor -> Event t a -> m (Event t b, Event t Bool) waitFor op input = do - result <- op input >>= R.debounce (0.2 :: NominalDiffTime) + result <- op input >>= R.debounce (0.5 :: NominalDiffTime) let waiting = R.leftmost [ const True <$> input , const False <$> result ] return (result, waiting) -- cgit v1.2.3 From c542424b7b41c78a170763f6996c12f56b359860 Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 10 Aug 2019 21:31:27 +0200 Subject: Add smooth transitions to modal show and hide --- client/src/Util/WaitFor.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client/src/Util/WaitFor.hs') diff --git a/client/src/Util/WaitFor.hs b/client/src/Util/WaitFor.hs index 02edff5..fe7b733 100644 --- a/client/src/Util/WaitFor.hs +++ b/client/src/Util/WaitFor.hs @@ -13,5 +13,5 @@ waitFor -> m (Event t b, Event t Bool) waitFor op input = do result <- op input >>= R.debounce (0.5 :: NominalDiffTime) - let waiting = R.leftmost [ const True <$> input , const False <$> result ] + let waiting = R.leftmost [ True <$ input , False <$ result ] return (result, waiting) -- cgit v1.2.3