{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.WorkerGlobalScope
(fetch, fetch_, close, importScripts, getIndexedDB, getSelf,
getLocation, error, offline, online, getNavigator,
WorkerGlobalScope(..), gTypeWorkerGlobalScope, IsWorkerGlobalScope,
toWorkerGlobalScope)
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
fetch ::
(MonadDOM m, IsWorkerGlobalScope self, ToJSVal input) =>
self -> input -> Maybe RequestInit -> m Response
fetch :: forall (m :: * -> *) self input.
(MonadDOM m, IsWorkerGlobalScope self, ToJSVal input) =>
self -> input -> Maybe RequestInit -> m Response
fetch self
self input
input Maybe RequestInit
init
= DOM Response -> m Response
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
((((self -> WorkerGlobalScope
forall o. IsWorkerGlobalScope o => o -> WorkerGlobalScope
toWorkerGlobalScope self
self) WorkerGlobalScope
-> Getting (JSM JSVal) WorkerGlobalScope (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> [JSM JSVal] -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf String
"fetch"
[input -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal input
input, Maybe RequestInit -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe RequestInit
init])
JSM JSVal -> (JSVal -> JSM JSVal) -> JSM JSVal
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> JSM JSVal
readPromise)
JSM JSVal -> (JSVal -> DOM Response) -> DOM Response
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Response
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
fetch_ ::
(MonadDOM m, IsWorkerGlobalScope self, ToJSVal input) =>
self -> input -> Maybe RequestInit -> m ()
fetch_ :: forall (m :: * -> *) self input.
(MonadDOM m, IsWorkerGlobalScope self, ToJSVal input) =>
self -> input -> Maybe RequestInit -> m ()
fetch_ self
self input
input Maybe RequestInit
init
= DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void
((self -> WorkerGlobalScope
forall o. IsWorkerGlobalScope o => o -> WorkerGlobalScope
toWorkerGlobalScope self
self) WorkerGlobalScope
-> Getting (JSM JSVal) WorkerGlobalScope (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> [JSM JSVal] -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf String
"fetch"
[input -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal input
input, Maybe RequestInit -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe RequestInit
init]))
close :: (MonadDOM m, IsWorkerGlobalScope self) => self -> m ()
close :: forall (m :: * -> *) self.
(MonadDOM m, IsWorkerGlobalScope self) =>
self -> m ()
close self
self
= DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void ((self -> WorkerGlobalScope
forall o. IsWorkerGlobalScope o => o -> WorkerGlobalScope
toWorkerGlobalScope self
self) WorkerGlobalScope
-> Getting (JSM JSVal) WorkerGlobalScope (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> () -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf String
"close" ()))
importScripts ::
(MonadDOM m, IsWorkerGlobalScope self, ToJSString urls) =>
self -> [urls] -> m ()
importScripts :: forall (m :: * -> *) self urls.
(MonadDOM m, IsWorkerGlobalScope self, ToJSString urls) =>
self -> [urls] -> m ()
importScripts self
self [urls]
urls
= DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void
((self -> WorkerGlobalScope
forall o. IsWorkerGlobalScope o => o -> WorkerGlobalScope
toWorkerGlobalScope self
self) WorkerGlobalScope
-> Getting (JSM JSVal) WorkerGlobalScope (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> [JSM JSVal] -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf String
"importScripts"
[JSM Object -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal ([urls] -> JSM Object
forall args. MakeArgs args => args -> JSM Object
array [urls]
urls)]))
getIndexedDB ::
(MonadDOM m, IsWorkerGlobalScope self) => self -> m IDBFactory
getIndexedDB :: forall (m :: * -> *) self.
(MonadDOM m, IsWorkerGlobalScope self) =>
self -> m IDBFactory
getIndexedDB self
self
= DOM IDBFactory -> m IDBFactory
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(((self -> WorkerGlobalScope
forall o. IsWorkerGlobalScope o => o -> WorkerGlobalScope
toWorkerGlobalScope self
self) WorkerGlobalScope
-> Getting (JSM JSVal) WorkerGlobalScope (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter WorkerGlobalScope (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"indexedDB") JSM JSVal -> (JSVal -> DOM IDBFactory) -> DOM IDBFactory
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
JSVal -> DOM IDBFactory
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
getSelf ::
(MonadDOM m, IsWorkerGlobalScope self) =>
self -> m WorkerGlobalScope
getSelf :: forall (m :: * -> *) self.
(MonadDOM m, IsWorkerGlobalScope self) =>
self -> m WorkerGlobalScope
getSelf self
self
= DOM WorkerGlobalScope -> m WorkerGlobalScope
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(((self -> WorkerGlobalScope
forall o. IsWorkerGlobalScope o => o -> WorkerGlobalScope
toWorkerGlobalScope self
self) WorkerGlobalScope
-> Getting (JSM JSVal) WorkerGlobalScope (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter WorkerGlobalScope (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"self") JSM JSVal
-> (JSVal -> DOM WorkerGlobalScope) -> DOM WorkerGlobalScope
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM WorkerGlobalScope
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
getLocation ::
(MonadDOM m, IsWorkerGlobalScope self) => self -> m WorkerLocation
getLocation :: forall (m :: * -> *) self.
(MonadDOM m, IsWorkerGlobalScope self) =>
self -> m WorkerLocation
getLocation self
self
= DOM WorkerLocation -> m WorkerLocation
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(((self -> WorkerGlobalScope
forall o. IsWorkerGlobalScope o => o -> WorkerGlobalScope
toWorkerGlobalScope self
self) WorkerGlobalScope
-> Getting (JSM JSVal) WorkerGlobalScope (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter WorkerGlobalScope (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"location") JSM JSVal -> (JSVal -> DOM WorkerLocation) -> DOM WorkerLocation
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
JSVal -> DOM WorkerLocation
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
error ::
(IsWorkerGlobalScope self, IsEventTarget self) =>
EventName self UIEvent
error :: forall self.
(IsWorkerGlobalScope self, IsEventTarget self) =>
EventName self UIEvent
error = DOMString -> EventName self UIEvent
forall t e. DOMString -> EventName t e
unsafeEventNameAsync (String -> DOMString
forall a. ToJSString a => a -> DOMString
toJSString String
"error")
offline ::
(IsWorkerGlobalScope self, IsEventTarget self) =>
EventName self Event
offline :: forall self.
(IsWorkerGlobalScope self, IsEventTarget self) =>
EventName self Event
offline = DOMString -> EventName self Event
forall t e. DOMString -> EventName t e
unsafeEventName (String -> DOMString
forall a. ToJSString a => a -> DOMString
toJSString String
"offline")
online ::
(IsWorkerGlobalScope self, IsEventTarget self) =>
EventName self Event
online :: forall self.
(IsWorkerGlobalScope self, IsEventTarget self) =>
EventName self Event
online = DOMString -> EventName self Event
forall t e. DOMString -> EventName t e
unsafeEventName (String -> DOMString
forall a. ToJSString a => a -> DOMString
toJSString String
"online")
getNavigator ::
(MonadDOM m, IsWorkerGlobalScope self) => self -> m WorkerNavigator
getNavigator :: forall (m :: * -> *) self.
(MonadDOM m, IsWorkerGlobalScope self) =>
self -> m WorkerNavigator
getNavigator self
self
= DOM WorkerNavigator -> m WorkerNavigator
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(((self -> WorkerGlobalScope
forall o. IsWorkerGlobalScope o => o -> WorkerGlobalScope
toWorkerGlobalScope self
self) WorkerGlobalScope
-> Getting (JSM JSVal) WorkerGlobalScope (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter WorkerGlobalScope (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"navigator") JSM JSVal -> (JSVal -> DOM WorkerNavigator) -> DOM WorkerNavigator
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
JSVal -> DOM WorkerNavigator
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)