module Dingo.Callback ( CallbackM , addWidget , sendJavascript , setWidgetContents ) where import Data.Text (Text) import Dingo.Internal.Base (Command(..)) import Dingo.Internal.Callback (CallbackM, addCommand, addWidget) import Dingo.Widget (Widget(..)) import Text.Blaze (Html) import Text.Julius (JavascriptUrl) -- | Set the widget contents to the given HTML element. setWidgetContents :: Widget w s => w -> Html -> CallbackM () setWidgetContents w h = addCommand $ ReplaceWidgetChildren (getWidgetId w) h -- | Send raw Javascript to the browser. sendJavascript :: JavascriptUrl Text -> CallbackM () sendJavascript = addCommand . RawJavascript