{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.URL
(newURL, newURL', newURL'', toJSON, toJSON_, createObjectURL,
createObjectURL_, revokeObjectURL, createObjectURLSource,
createObjectURLSource_, setHref, getHref, getOrigin, setProtocol,
getProtocol, setUsername, getUsername, setPassword, getPassword,
setHost, getHost, setHostname, getHostname, setPort, getPort,
setPathname, getPathname, setHash, getHash, setSearch, getSearch,
getSearchParams, URL(..), gTypeURL)
where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Enums
newURL :: (MonadDOM m, ToJSString url) => url -> m URL
newURL url = liftDOM (URL <$> new (jsg "URL") [toJSVal url])
newURL' ::
(MonadDOM m, ToJSString url, ToJSString base) =>
url -> base -> m URL
newURL' url base
= liftDOM (URL <$> new (jsg "URL") [toJSVal url, toJSVal base])
newURL'' :: (MonadDOM m, ToJSString url) => url -> URL -> m URL
newURL'' url base
= liftDOM (URL <$> new (jsg "URL") [toJSVal url, toJSVal base])
toJSON :: (MonadDOM m, FromJSString result) => URL -> m result
toJSON self
= liftDOM ((self ^. jsf "toJSON" ()) >>= fromJSValUnchecked)
toJSON_ :: (MonadDOM m) => URL -> m ()
toJSON_ self = liftDOM (void (self ^. jsf "toJSON" ()))
createObjectURL ::
(MonadDOM m, IsBlob blob, FromJSString result) => blob -> m result
createObjectURL blob
= liftDOM
(((jsg "URL") ^. jsf "createObjectURL" [toJSVal blob]) >>=
fromJSValUnchecked)
createObjectURL_ :: (MonadDOM m, IsBlob blob) => blob -> m ()
createObjectURL_ blob
= liftDOM
(void ((jsg "URL") ^. jsf "createObjectURL" [toJSVal blob]))
revokeObjectURL :: (MonadDOM m, ToJSString url) => url -> m ()
revokeObjectURL url
= liftDOM
(void ((jsg "URL") ^. jsf "revokeObjectURL" [toJSVal url]))
createObjectURLSource ::
(MonadDOM m, FromJSString result) => MediaSource -> m result
createObjectURLSource source
= liftDOM
(((jsg "URL") ^. jsf "createObjectURL" [toJSVal source]) >>=
fromJSValUnchecked)
createObjectURLSource_ :: (MonadDOM m) => MediaSource -> m ()
createObjectURLSource_ source
= liftDOM
(void ((jsg "URL") ^. jsf "createObjectURL" [toJSVal source]))
setHref :: (MonadDOM m, ToJSString val) => URL -> val -> m ()
setHref self val = liftDOM (self ^. jss "href" (toJSVal val))
getHref :: (MonadDOM m, FromJSString result) => URL -> m result
getHref self = liftDOM ((self ^. js "href") >>= fromJSValUnchecked)
getOrigin :: (MonadDOM m, FromJSString result) => URL -> m result
getOrigin self
= liftDOM ((self ^. js "origin") >>= fromJSValUnchecked)
setProtocol :: (MonadDOM m, ToJSString val) => URL -> val -> m ()
setProtocol self val
= liftDOM (self ^. jss "protocol" (toJSVal val))
getProtocol :: (MonadDOM m, FromJSString result) => URL -> m result
getProtocol self
= liftDOM ((self ^. js "protocol") >>= fromJSValUnchecked)
setUsername :: (MonadDOM m, ToJSString val) => URL -> val -> m ()
setUsername self val
= liftDOM (self ^. jss "username" (toJSVal val))
getUsername :: (MonadDOM m, FromJSString result) => URL -> m result
getUsername self
= liftDOM ((self ^. js "username") >>= fromJSValUnchecked)
setPassword :: (MonadDOM m, ToJSString val) => URL -> val -> m ()
setPassword self val
= liftDOM (self ^. jss "password" (toJSVal val))
getPassword :: (MonadDOM m, FromJSString result) => URL -> m result
getPassword self
= liftDOM ((self ^. js "password") >>= fromJSValUnchecked)
setHost :: (MonadDOM m, ToJSString val) => URL -> val -> m ()
setHost self val = liftDOM (self ^. jss "host" (toJSVal val))
getHost :: (MonadDOM m, FromJSString result) => URL -> m result
getHost self = liftDOM ((self ^. js "host") >>= fromJSValUnchecked)
setHostname :: (MonadDOM m, ToJSString val) => URL -> val -> m ()
setHostname self val
= liftDOM (self ^. jss "hostname" (toJSVal val))
getHostname :: (MonadDOM m, FromJSString result) => URL -> m result
getHostname self
= liftDOM ((self ^. js "hostname") >>= fromJSValUnchecked)
setPort :: (MonadDOM m, ToJSString val) => URL -> val -> m ()
setPort self val = liftDOM (self ^. jss "port" (toJSVal val))
getPort :: (MonadDOM m, FromJSString result) => URL -> m result
getPort self = liftDOM ((self ^. js "port") >>= fromJSValUnchecked)
setPathname :: (MonadDOM m, ToJSString val) => URL -> val -> m ()
setPathname self val
= liftDOM (self ^. jss "pathname" (toJSVal val))
getPathname :: (MonadDOM m, FromJSString result) => URL -> m result
getPathname self
= liftDOM ((self ^. js "pathname") >>= fromJSValUnchecked)
setHash :: (MonadDOM m, ToJSString val) => URL -> val -> m ()
setHash self val = liftDOM (self ^. jss "hash" (toJSVal val))
getHash :: (MonadDOM m, FromJSString result) => URL -> m result
getHash self = liftDOM ((self ^. js "hash") >>= fromJSValUnchecked)
setSearch :: (MonadDOM m, ToJSString val) => URL -> val -> m ()
setSearch self val = liftDOM (self ^. jss "search" (toJSVal val))
getSearch :: (MonadDOM m, FromJSString result) => URL -> m result
getSearch self
= liftDOM ((self ^. js "search") >>= fromJSValUnchecked)
getSearchParams :: (MonadDOM m) => URL -> m URLSearchParams
getSearchParams self
= liftDOM ((self ^. js "searchParams") >>= fromJSValUnchecked)