packages feed

reflex-dom-core 0.7.0.0 → 0.7.0.1

raw patch · 3 files changed

+19/−3 lines, 3 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Reflex.Dom.Xhr.FormData: postForms' :: (IsBlob blob, MonadJSM (Performable m), PerformEvent t m, TriggerEvent t m, Traversable f) => Text -> XhrRequestConfig a -> Event t (f (Map Text (FormValue blob))) -> m (Event t (f XhrResponse))

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for reflex-dom-core +## 0.7.0.1++* Add a variant of `postForms` that allows the `XhrRequestConfig` to be specified.+ ## 0.7.0.0  * Breaking change: Remove HasJSContext and MonadJS. This change also removes the `js` type parameter from `Prerender`. Change `Prerender js t m` to `Prerender t m`.
reflex-dom-core.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.24 Name: reflex-dom-core-Version: 0.7.0.0+Version: 0.7.0.1 Synopsis: Functional Reactive Web Apps with Reflex Description:   Web applications without callbacks or side-effects.
src/Reflex/Dom/Xhr/FormData.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} module Reflex.Dom.Xhr.FormData   ( postForms+  , postForms'   , FormValue (..)   , fileToFormValue   )@@ -32,13 +33,24 @@   => Text -- ^ The target url   -> Event t (f (Map Text (FormValue blob))) -- ^ Maps of text keys and values that will be sent as "FormData"   -> m (Event t (f XhrResponse))-postForms url payload = do+postForms t = postForms' t def++-- | Like 'postForms' but doesn't use a default 'XhrRequestConfig', so a custom one can be provided.+postForms'+  :: ( IsBlob blob, MonadJSM (Performable m)+     , PerformEvent t m, TriggerEvent t m+     , Traversable f)+  => Text -- ^ The target url+  -> XhrRequestConfig a+  -> Event t (f (Map Text (FormValue blob))) -- ^ Maps of text keys and values that will be sent as "FormData"+  -> m (Event t (f XhrResponse))+postForms' url cfg payload = do   performMkRequestsAsync $ ffor payload $ \fs -> for fs $ \u -> liftJSM $ do     fd <- FD.newFormData Nothing     iforM_ u $ \k v -> case v of       FormValue_Text t -> FD.append fd k t       FormValue_File b fn -> FD.appendBlob fd k b fn-    return $ xhrRequest "POST" url $ def & xhrRequestConfig_sendData .~ fd+    return $ xhrRequest "POST" url $ cfg & xhrRequestConfig_sendData .~ fd  -- | Converts a File (e.g., the output of a 'FileInput') into a 'FormValue'. The filename will be included if it is available. fileToFormValue :: MonadJSM m => File -> m (FormValue File)