{-# LANGUAGE PatternSynonyms #-}
-- For HasCallStack compatibility
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.SecurityPolicyViolationEvent
       (newSecurityPolicyViolationEvent, getDocumentURI, getReferrer,
        getBlockedURI, getViolatedDirective, getEffectiveDirective,
        getOriginalPolicy, getSourceFile, getStatusCode, getLineNumber,
        getColumnNumber, SecurityPolicyViolationEvent(..),
        gTypeSecurityPolicyViolationEvent)
       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

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent Mozilla SecurityPolicyViolationEvent documentation> 
newSecurityPolicyViolationEvent ::
                                (MonadDOM m, ToJSString type') =>
                                  type' ->
                                    Maybe SecurityPolicyViolationEventInit ->
                                      m SecurityPolicyViolationEvent
newSecurityPolicyViolationEvent :: forall (m :: * -> *) type'.
(MonadDOM m, ToJSString type') =>
type'
-> Maybe SecurityPolicyViolationEventInit
-> m SecurityPolicyViolationEvent
newSecurityPolicyViolationEvent type'
type' Maybe SecurityPolicyViolationEventInit
eventInitDict
  = DOM SecurityPolicyViolationEvent -> m SecurityPolicyViolationEvent
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (JSVal -> SecurityPolicyViolationEvent
SecurityPolicyViolationEvent (JSVal -> SecurityPolicyViolationEvent)
-> JSM JSVal -> DOM SecurityPolicyViolationEvent
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
         JSM JSVal -> [JSM JSVal] -> JSM JSVal
forall constructor args.
(MakeObject constructor, MakeArgs args) =>
constructor -> args -> JSM JSVal
new (String -> JSM JSVal
forall a. ToJSString a => a -> JSM JSVal
jsg String
"SecurityPolicyViolationEvent")
           [type' -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal type'
type', Maybe SecurityPolicyViolationEventInit -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe SecurityPolicyViolationEventInit
eventInitDict])

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent.documentURI Mozilla SecurityPolicyViolationEvent.documentURI documentation> 
getDocumentURI ::
               (MonadDOM m, FromJSString result) =>
                 SecurityPolicyViolationEvent -> m result
getDocumentURI :: forall (m :: * -> *) result.
(MonadDOM m, FromJSString result) =>
SecurityPolicyViolationEvent -> m result
getDocumentURI SecurityPolicyViolationEvent
self
  = DOM result -> m result
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((SecurityPolicyViolationEvent
self SecurityPolicyViolationEvent
-> Getting (JSM JSVal) SecurityPolicyViolationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SecurityPolicyViolationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"documentURI") JSM JSVal -> (JSVal -> DOM result) -> DOM result
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 result
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent.referrer Mozilla SecurityPolicyViolationEvent.referrer documentation> 
getReferrer ::
            (MonadDOM m, FromJSString result) =>
              SecurityPolicyViolationEvent -> m result
getReferrer :: forall (m :: * -> *) result.
(MonadDOM m, FromJSString result) =>
SecurityPolicyViolationEvent -> m result
getReferrer SecurityPolicyViolationEvent
self
  = DOM result -> m result
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((SecurityPolicyViolationEvent
self SecurityPolicyViolationEvent
-> Getting (JSM JSVal) SecurityPolicyViolationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SecurityPolicyViolationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"referrer") JSM JSVal -> (JSVal -> DOM result) -> DOM result
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 result
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent.blockedURI Mozilla SecurityPolicyViolationEvent.blockedURI documentation> 
getBlockedURI ::
              (MonadDOM m, FromJSString result) =>
                SecurityPolicyViolationEvent -> m result
getBlockedURI :: forall (m :: * -> *) result.
(MonadDOM m, FromJSString result) =>
SecurityPolicyViolationEvent -> m result
getBlockedURI SecurityPolicyViolationEvent
self
  = DOM result -> m result
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((SecurityPolicyViolationEvent
self SecurityPolicyViolationEvent
-> Getting (JSM JSVal) SecurityPolicyViolationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SecurityPolicyViolationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"blockedURI") JSM JSVal -> (JSVal -> DOM result) -> DOM result
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 result
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent.violatedDirective Mozilla SecurityPolicyViolationEvent.violatedDirective documentation> 
getViolatedDirective ::
                     (MonadDOM m, FromJSString result) =>
                       SecurityPolicyViolationEvent -> m result
getViolatedDirective :: forall (m :: * -> *) result.
(MonadDOM m, FromJSString result) =>
SecurityPolicyViolationEvent -> m result
getViolatedDirective SecurityPolicyViolationEvent
self
  = DOM result -> m result
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((SecurityPolicyViolationEvent
self SecurityPolicyViolationEvent
-> Getting (JSM JSVal) SecurityPolicyViolationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SecurityPolicyViolationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"violatedDirective") JSM JSVal -> (JSVal -> DOM result) -> DOM result
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 result
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent.effectiveDirective Mozilla SecurityPolicyViolationEvent.effectiveDirective documentation> 
getEffectiveDirective ::
                      (MonadDOM m, FromJSString result) =>
                        SecurityPolicyViolationEvent -> m result
getEffectiveDirective :: forall (m :: * -> *) result.
(MonadDOM m, FromJSString result) =>
SecurityPolicyViolationEvent -> m result
getEffectiveDirective SecurityPolicyViolationEvent
self
  = DOM result -> m result
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      ((SecurityPolicyViolationEvent
self SecurityPolicyViolationEvent
-> Getting (JSM JSVal) SecurityPolicyViolationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SecurityPolicyViolationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"effectiveDirective") JSM JSVal -> (JSVal -> DOM result) -> DOM result
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 result
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent.originalPolicy Mozilla SecurityPolicyViolationEvent.originalPolicy documentation> 
getOriginalPolicy ::
                  (MonadDOM m, FromJSString result) =>
                    SecurityPolicyViolationEvent -> m result
getOriginalPolicy :: forall (m :: * -> *) result.
(MonadDOM m, FromJSString result) =>
SecurityPolicyViolationEvent -> m result
getOriginalPolicy SecurityPolicyViolationEvent
self
  = DOM result -> m result
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((SecurityPolicyViolationEvent
self SecurityPolicyViolationEvent
-> Getting (JSM JSVal) SecurityPolicyViolationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SecurityPolicyViolationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"originalPolicy") JSM JSVal -> (JSVal -> DOM result) -> DOM result
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 result
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent.sourceFile Mozilla SecurityPolicyViolationEvent.sourceFile documentation> 
getSourceFile ::
              (MonadDOM m, FromJSString result) =>
                SecurityPolicyViolationEvent -> m result
getSourceFile :: forall (m :: * -> *) result.
(MonadDOM m, FromJSString result) =>
SecurityPolicyViolationEvent -> m result
getSourceFile SecurityPolicyViolationEvent
self
  = DOM result -> m result
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((SecurityPolicyViolationEvent
self SecurityPolicyViolationEvent
-> Getting (JSM JSVal) SecurityPolicyViolationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SecurityPolicyViolationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"sourceFile") JSM JSVal -> (JSVal -> DOM result) -> DOM result
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 result
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent.statusCode Mozilla SecurityPolicyViolationEvent.statusCode documentation> 
getStatusCode ::
              (MonadDOM m) => SecurityPolicyViolationEvent -> m Word
getStatusCode :: forall (m :: * -> *).
MonadDOM m =>
SecurityPolicyViolationEvent -> m Word
getStatusCode SecurityPolicyViolationEvent
self
  = DOM Word -> m Word
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (Double -> Word
forall b. Integral b => Double -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Double -> Word) -> JSM Double -> DOM Word
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((SecurityPolicyViolationEvent
self SecurityPolicyViolationEvent
-> Getting (JSM JSVal) SecurityPolicyViolationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SecurityPolicyViolationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"statusCode") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
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 Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent.lineNumber Mozilla SecurityPolicyViolationEvent.lineNumber documentation> 
getLineNumber ::
              (MonadDOM m) => SecurityPolicyViolationEvent -> m Int
getLineNumber :: forall (m :: * -> *).
MonadDOM m =>
SecurityPolicyViolationEvent -> m Int
getLineNumber SecurityPolicyViolationEvent
self
  = DOM Int -> m Int
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (Double -> Int
forall b. Integral b => Double -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Double -> Int) -> JSM Double -> DOM Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((SecurityPolicyViolationEvent
self SecurityPolicyViolationEvent
-> Getting (JSM JSVal) SecurityPolicyViolationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SecurityPolicyViolationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"lineNumber") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
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 Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent.columnNumber Mozilla SecurityPolicyViolationEvent.columnNumber documentation> 
getColumnNumber ::
                (MonadDOM m) => SecurityPolicyViolationEvent -> m Int
getColumnNumber :: forall (m :: * -> *).
MonadDOM m =>
SecurityPolicyViolationEvent -> m Int
getColumnNumber SecurityPolicyViolationEvent
self
  = DOM Int -> m Int
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (Double -> Int
forall b. Integral b => Double -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Double -> Int) -> JSM Double -> DOM Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((SecurityPolicyViolationEvent
self SecurityPolicyViolationEvent
-> Getting (JSM JSVal) SecurityPolicyViolationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SecurityPolicyViolationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"columnNumber") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
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 Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))