packages feed

ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/HTMLOptionsCollection.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from html (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.HTMLOptionsCollection
       (js_add, js_remove, js_setLength, js_getLength, js_setSelectedIndex, js_getSelectedIndex, add, remove, setLength, getLength, setSelectedIndex, getSelectedIndex, HTMLOptionsCollection(..), gTypeHTMLOptionsCollection)
       where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import GHCJS.Types (JSVal, JSString)
import GHCJS.Foreign (jsUndefined, jsNull)
import GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums

foreign import javascript safe "(($1, $2, $3) => { return $1[\"add\"]($2, $3); })"
        js_add :: HTMLOptionsCollection -> HTMLOptionElementOrHTMLOptGroupElement -> JSVal -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/HTMLOptionsCollection/add MDN HTMLOptionsCollection.add documentation>
add :: (MonadDOM m, IsHTMLOptionElementOrHTMLOptGroupElement element, IsHTMLElementOrInt before) => HTMLOptionsCollection -> element -> Maybe before -> m ()
add self element before = liftDOM (void (((toJSVal before) >>= \a3' -> js_add (self) (Types.toHTMLOptionElementOrHTMLOptGroupElement element) a3')))

foreign import javascript safe "(($1, $2) => { return $1[\"remove\"]($2); })"
        js_remove :: HTMLOptionsCollection -> Int -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/HTMLOptionsCollection/remove MDN HTMLOptionsCollection.remove documentation>
remove :: (MonadDOM m) => HTMLOptionsCollection -> Int -> m ()
remove self index = liftDOM (void ((js_remove (self) (index))))

foreign import javascript safe "(($1, $2) => { $1[\"length\"] = $2; })"
        js_setLength :: HTMLOptionsCollection -> Word -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/HTMLOptionsCollection/length MDN HTMLOptionsCollection.length documentation>
setLength :: (MonadDOM m) => HTMLOptionsCollection -> Word -> m ()
setLength self val = liftDOM (void ((js_setLength (self) (val))))

foreign import javascript unsafe "(($1) => { return $1[\"length\"]; })"
        js_getLength :: HTMLOptionsCollection -> IO Word
-- | <https://developer.mozilla.org/docs/Web/API/HTMLOptionsCollection/length MDN HTMLOptionsCollection.length documentation>
getLength :: (MonadDOM m) => HTMLOptionsCollection -> m Word
getLength self = liftDOM ((js_getLength (self)))

foreign import javascript safe "(($1, $2) => { $1[\"selectedIndex\"] = $2; })"
        js_setSelectedIndex :: HTMLOptionsCollection -> Int -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/HTMLOptionsCollection/selectedIndex MDN HTMLOptionsCollection.selectedIndex documentation>
setSelectedIndex :: (MonadDOM m) => HTMLOptionsCollection -> Int -> m ()
setSelectedIndex self val = liftDOM (void ((js_setSelectedIndex (self) (val))))

foreign import javascript unsafe "(($1) => { return $1[\"selectedIndex\"]; })"
        js_getSelectedIndex :: HTMLOptionsCollection -> IO Int
-- | <https://developer.mozilla.org/docs/Web/API/HTMLOptionsCollection/selectedIndex MDN HTMLOptionsCollection.selectedIndex documentation>
getSelectedIndex :: (MonadDOM m) => HTMLOptionsCollection -> m Int
getSelectedIndex self = liftDOM ((js_getSelectedIndex (self)))