{-# LANGUAGE CPP #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE JavaScriptFFI #-} -- For HasCallStack compatibility {-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-} module GHCJS.DOM.JSFFI.Generated.DOMImplementation (js_hasFeature, hasFeature, hasFeature_, js_createDocumentType, createDocumentType, createDocumentType_, createDocumentTypeUnsafe, createDocumentTypeUnchecked, js_createDocument, createDocument, createDocument_, createDocumentUnsafe, createDocumentUnchecked, js_createCSSStyleSheet, createCSSStyleSheet, createCSSStyleSheet_, createCSSStyleSheetUnsafe, createCSSStyleSheetUnchecked, js_createHTMLDocument, createHTMLDocument, createHTMLDocument_, createHTMLDocumentUnsafe, createHTMLDocumentUnchecked, DOMImplementation(..), gTypeDOMImplementation) where import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, fmap, Show, Read, Eq, Ord) import qualified Prelude (error) import Data.Typeable (Typeable) import GHCJS.Types (JSVal(..), JSString) import GHCJS.Foreign (jsNull) import GHCJS.Foreign.Callback (syncCallback, asyncCallback, syncCallback1, asyncCallback1, syncCallback2, asyncCallback2, OnBlocked(..)) import GHCJS.Marshal (ToJSVal(..), FromJSVal(..)) import GHCJS.Marshal.Pure (PToJSVal(..), PFromJSVal(..)) import Control.Monad (void) import Control.Monad.IO.Class (MonadIO(..)) import Data.Int (Int64) import Data.Word (Word, Word64) import Data.Maybe (fromJust) import GHCJS.DOM.Types import Control.Applicative ((<$>)) import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName) import GHCJS.DOM.JSFFI.Generated.Enums #if MIN_VERSION_base(4,9,0) import GHC.Stack (HasCallStack) #elif MIN_VERSION_base(4,8,0) import GHC.Stack (CallStack) import GHC.Exts (Constraint) type HasCallStack = ((?callStack :: CallStack) :: Constraint) #else import GHC.Exts (Constraint) type HasCallStack = (() :: Constraint) #endif foreign import javascript unsafe "($1[\"hasFeature\"]($2,\n$3) ? 1 : 0)" js_hasFeature :: DOMImplementation -> JSString -> Nullable JSString -> IO Bool -- | hasFeature :: (MonadIO m, ToJSString feature, ToJSString version) => DOMImplementation -> feature -> Maybe version -> m Bool hasFeature self feature version = liftIO (js_hasFeature (self) (toJSString feature) (toMaybeJSString version)) -- | hasFeature_ :: (MonadIO m, ToJSString feature, ToJSString version) => DOMImplementation -> feature -> Maybe version -> m () hasFeature_ self feature version = liftIO (void (js_hasFeature (self) (toJSString feature) (toMaybeJSString version))) foreign import javascript unsafe "$1[\"createDocumentType\"]($2, $3,\n$4)" js_createDocumentType :: DOMImplementation -> Nullable JSString -> Nullable JSString -> Nullable JSString -> IO (Nullable DocumentType) -- | createDocumentType :: (MonadIO m, ToJSString qualifiedName, ToJSString publicId, ToJSString systemId) => DOMImplementation -> Maybe qualifiedName -> Maybe publicId -> Maybe systemId -> m (Maybe DocumentType) createDocumentType self qualifiedName publicId systemId = liftIO (nullableToMaybe <$> (js_createDocumentType (self) (toMaybeJSString qualifiedName) (toMaybeJSString publicId) (toMaybeJSString systemId))) -- | createDocumentType_ :: (MonadIO m, ToJSString qualifiedName, ToJSString publicId, ToJSString systemId) => DOMImplementation -> Maybe qualifiedName -> Maybe publicId -> Maybe systemId -> m () createDocumentType_ self qualifiedName publicId systemId = liftIO (void (js_createDocumentType (self) (toMaybeJSString qualifiedName) (toMaybeJSString publicId) (toMaybeJSString systemId))) -- | createDocumentTypeUnsafe :: (MonadIO m, ToJSString qualifiedName, ToJSString publicId, ToJSString systemId, HasCallStack) => DOMImplementation -> Maybe qualifiedName -> Maybe publicId -> Maybe systemId -> m DocumentType createDocumentTypeUnsafe self qualifiedName publicId systemId = liftIO ((nullableToMaybe <$> (js_createDocumentType (self) (toMaybeJSString qualifiedName) (toMaybeJSString publicId) (toMaybeJSString systemId))) >>= maybe (Prelude.error "Nothing to return") return) -- | createDocumentTypeUnchecked :: (MonadIO m, ToJSString qualifiedName, ToJSString publicId, ToJSString systemId) => DOMImplementation -> Maybe qualifiedName -> Maybe publicId -> Maybe systemId -> m DocumentType createDocumentTypeUnchecked self qualifiedName publicId systemId = liftIO (fromJust . nullableToMaybe <$> (js_createDocumentType (self) (toMaybeJSString qualifiedName) (toMaybeJSString publicId) (toMaybeJSString systemId))) foreign import javascript unsafe "$1[\"createDocument\"]($2, $3, $4)" js_createDocument :: DOMImplementation -> Nullable JSString -> Nullable JSString -> Nullable DocumentType -> IO (Nullable Document) -- | createDocument :: (MonadIO m, ToJSString namespaceURI, ToJSString qualifiedName) => DOMImplementation -> Maybe namespaceURI -> Maybe qualifiedName -> Maybe DocumentType -> m (Maybe Document) createDocument self namespaceURI qualifiedName doctype = liftIO (nullableToMaybe <$> (js_createDocument (self) (toMaybeJSString namespaceURI) (toMaybeJSString qualifiedName) (maybeToNullable doctype))) -- | createDocument_ :: (MonadIO m, ToJSString namespaceURI, ToJSString qualifiedName) => DOMImplementation -> Maybe namespaceURI -> Maybe qualifiedName -> Maybe DocumentType -> m () createDocument_ self namespaceURI qualifiedName doctype = liftIO (void (js_createDocument (self) (toMaybeJSString namespaceURI) (toMaybeJSString qualifiedName) (maybeToNullable doctype))) -- | createDocumentUnsafe :: (MonadIO m, ToJSString namespaceURI, ToJSString qualifiedName, HasCallStack) => DOMImplementation -> Maybe namespaceURI -> Maybe qualifiedName -> Maybe DocumentType -> m Document createDocumentUnsafe self namespaceURI qualifiedName doctype = liftIO ((nullableToMaybe <$> (js_createDocument (self) (toMaybeJSString namespaceURI) (toMaybeJSString qualifiedName) (maybeToNullable doctype))) >>= maybe (Prelude.error "Nothing to return") return) -- | createDocumentUnchecked :: (MonadIO m, ToJSString namespaceURI, ToJSString qualifiedName) => DOMImplementation -> Maybe namespaceURI -> Maybe qualifiedName -> Maybe DocumentType -> m Document createDocumentUnchecked self namespaceURI qualifiedName doctype = liftIO (fromJust . nullableToMaybe <$> (js_createDocument (self) (toMaybeJSString namespaceURI) (toMaybeJSString qualifiedName) (maybeToNullable doctype))) foreign import javascript unsafe "$1[\"createCSSStyleSheet\"]($2,\n$3)" js_createCSSStyleSheet :: DOMImplementation -> JSString -> JSString -> IO (Nullable CSSStyleSheet) -- | createCSSStyleSheet :: (MonadIO m, ToJSString title, ToJSString media) => DOMImplementation -> title -> media -> m (Maybe CSSStyleSheet) createCSSStyleSheet self title media = liftIO (nullableToMaybe <$> (js_createCSSStyleSheet (self) (toJSString title) (toJSString media))) -- | createCSSStyleSheet_ :: (MonadIO m, ToJSString title, ToJSString media) => DOMImplementation -> title -> media -> m () createCSSStyleSheet_ self title media = liftIO (void (js_createCSSStyleSheet (self) (toJSString title) (toJSString media))) -- | createCSSStyleSheetUnsafe :: (MonadIO m, ToJSString title, ToJSString media, HasCallStack) => DOMImplementation -> title -> media -> m CSSStyleSheet createCSSStyleSheetUnsafe self title media = liftIO ((nullableToMaybe <$> (js_createCSSStyleSheet (self) (toJSString title) (toJSString media))) >>= maybe (Prelude.error "Nothing to return") return) -- | createCSSStyleSheetUnchecked :: (MonadIO m, ToJSString title, ToJSString media) => DOMImplementation -> title -> media -> m CSSStyleSheet createCSSStyleSheetUnchecked self title media = liftIO (fromJust . nullableToMaybe <$> (js_createCSSStyleSheet (self) (toJSString title) (toJSString media))) foreign import javascript unsafe "$1[\"createHTMLDocument\"]($2)" js_createHTMLDocument :: DOMImplementation -> JSString -> IO (Nullable HTMLDocument) -- | createHTMLDocument :: (MonadIO m, ToJSString title) => DOMImplementation -> title -> m (Maybe HTMLDocument) createHTMLDocument self title = liftIO (nullableToMaybe <$> (js_createHTMLDocument (self) (toJSString title))) -- | createHTMLDocument_ :: (MonadIO m, ToJSString title) => DOMImplementation -> title -> m () createHTMLDocument_ self title = liftIO (void (js_createHTMLDocument (self) (toJSString title))) -- | createHTMLDocumentUnsafe :: (MonadIO m, ToJSString title, HasCallStack) => DOMImplementation -> title -> m HTMLDocument createHTMLDocumentUnsafe self title = liftIO ((nullableToMaybe <$> (js_createHTMLDocument (self) (toJSString title))) >>= maybe (Prelude.error "Nothing to return") return) -- | createHTMLDocumentUnchecked :: (MonadIO m, ToJSString title) => DOMImplementation -> title -> m HTMLDocument createHTMLDocumentUnchecked self title = liftIO (fromJust . nullableToMaybe <$> (js_createHTMLDocument (self) (toJSString title)))