{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.FontFaceSet
(newFontFaceSet, has, has_, add, add_, delete, delete_, clear,
load, load_, check, check_, getSize, loading, loadingDone,
loadingerror, getReady, getStatus, FontFaceSet(..),
gTypeFontFaceSet)
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
newFontFaceSet :: (MonadDOM m) => [FontFace] -> m FontFaceSet
newFontFaceSet initialFaces
= liftDOM
(FontFaceSet <$>
new (jsg "FontFaceSet") [toJSVal (array initialFaces)])
has :: (MonadDOM m) => FontFaceSet -> FontFace -> m Bool
has self font
= liftDOM ((self ^. jsf "has" [toJSVal font]) >>= valToBool)
has_ :: (MonadDOM m) => FontFaceSet -> FontFace -> m ()
has_ self font = liftDOM (void (self ^. jsf "has" [toJSVal font]))
add :: (MonadDOM m) => FontFaceSet -> FontFace -> m FontFaceSet
add self font
= liftDOM
((self ^. jsf "add" [toJSVal font]) >>= fromJSValUnchecked)
add_ :: (MonadDOM m) => FontFaceSet -> FontFace -> m ()
add_ self font = liftDOM (void (self ^. jsf "add" [toJSVal font]))
delete :: (MonadDOM m) => FontFaceSet -> FontFace -> m Bool
delete self font
= liftDOM ((self ^. jsf "delete" [toJSVal font]) >>= valToBool)
delete_ :: (MonadDOM m) => FontFaceSet -> FontFace -> m ()
delete_ self font
= liftDOM (void (self ^. jsf "delete" [toJSVal font]))
clear :: (MonadDOM m) => FontFaceSet -> m ()
clear self = liftDOM (void (self ^. jsf "clear" ()))
load ::
(MonadDOM m, ToJSString font, ToJSString text) =>
FontFaceSet -> font -> Maybe text -> m [FontFace]
load self font text
= liftDOM
(((self ^. jsf "load" [toJSVal font, toJSVal text]) >>=
readPromise)
>>= fromJSArrayUnchecked)
load_ ::
(MonadDOM m, ToJSString font, ToJSString text) =>
FontFaceSet -> font -> Maybe text -> m ()
load_ self font text
= liftDOM (void (self ^. jsf "load" [toJSVal font, toJSVal text]))
check ::
(MonadDOM m, ToJSString font, ToJSString text) =>
FontFaceSet -> font -> Maybe text -> m Bool
check self font text
= liftDOM
((self ^. jsf "check" [toJSVal font, toJSVal text]) >>= valToBool)
check_ ::
(MonadDOM m, ToJSString font, ToJSString text) =>
FontFaceSet -> font -> Maybe text -> m ()
check_ self font text
= liftDOM (void (self ^. jsf "check" [toJSVal font, toJSVal text]))
getSize :: (MonadDOM m) => FontFaceSet -> m Int
getSize self
= liftDOM (round <$> ((self ^. js "size") >>= valToNumber))
loading :: EventName FontFaceSet Event
loading = unsafeEventName (toJSString "loading")
loadingDone :: EventName FontFaceSet Event
loadingDone = unsafeEventName (toJSString "loadingdone")
loadingerror :: EventName FontFaceSet onloadingerror
loadingerror = unsafeEventName (toJSString "loadingerror")
getReady :: (MonadDOM m) => FontFaceSet -> m FontFaceSet
getReady self
= liftDOM
(((self ^. js "ready") >>= readPromise) >>= fromJSValUnchecked)
getStatus :: (MonadDOM m) => FontFaceSet -> m FontFaceSetLoadStatus
getStatus self
= liftDOM ((self ^. js "status") >>= fromJSValUnchecked)