----------------------------------------------------------------------------- {-# LANGUAGE OverloadedStrings #-} ----------------------------------------------------------------------------- -- | -- Module : Miso.Native.X.Element.ScrollCoordinator.Method -- Copyright : (C) 2016-2026 David M. Johnson -- License : BSD3-style (see the file LICENSE) -- Maintainer : David M. Johnson <code@dmj.io> -- Stability : experimental -- Portability : non-portable -- -- @since 1.13.0.0 ---------------------------------------------------------------------------- module Miso.Native.X.Element.ScrollCoordinator.Method ( -- *** Methods setFoldExpanded ) where ----------------------------------------------------------------------------- import Miso import Miso.Native.FFI (invokeExec) ----------------------------------------------------------------------------- -- | Params object for 'setFoldExpanded'. data SetFoldExpanded = SetFoldExpanded MisoString Bool ----------------------------------------------------------------------------- instance ToJSVal SetFoldExpanded where toJSVal :: SetFoldExpanded -> IO JSVal toJSVal (SetFoldExpanded Text offset_ Bool smooth) = do o <- IO Object create set "offset" offset_ o set "smooth" smooth o toJSVal o ----------------------------------------------------------------------------- -- | https://lynxjs.org/api/elements/built-in/scroll-coordinator.html#setfoldexpanded -- -- Adjusts the fold expansion state, optionally with animation. The @offset_@ is -- a @px@ / @rpx@ value, e.g. @\"100px\"@. -- -- > setFoldExpanded "#coordinator" "100px" True Expanded ExpandFailed -- setFoldExpanded :: MisoString -> MisoString -- ^ Offset_ (px \/ rpx) -> Bool -- ^ Whether to animate -> action -> (MisoString -> action) -> Effect context props model action setFoldExpanded :: forall action context props model. Text -> Text -> Bool -> action -> (Text -> action) -> Effect context props model action setFoldExpanded Text selector Text offset_ Bool smooth action action = Text -> Text -> SetFoldExpanded -> (() -> action) -> (Text -> action) -> Effect context props model action forall params argument action context props model. (ToJSVal params, FromJSVal argument) => Text -> Text -> params -> (argument -> action) -> (Text -> action) -> Effect context props model action invokeExec Text "setFoldExpanded" Text selector (Text -> Bool -> SetFoldExpanded SetFoldExpanded Text offset_ Bool smooth) (\() -> action action) -----------------------------------------------------------------------------