jsaddle-dom-0.10.0.0: src/JSDOM/Generated/VideoFrameOutputCallback.hs
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webcodecs (webref). Do not edit.
module JSDOM.Generated.VideoFrameOutputCallback
(newVideoFrameOutputCallback, newVideoFrameOutputCallbackSync, newVideoFrameOutputCallbackAsync, VideoFrameOutputCallback)
where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import Language.Javascript.JSaddle (JSM, JSVal, JSString, toJSVal, valToBool, valToNumber, js, jss, jsf, jsg, new, function, asyncFunction, jsUndefined, jsNull)
import JSDOM.Types
import JSDOM.Generated.Enums
newVideoFrameOutputCallback :: (MonadDOM m) => (VideoFrame -> JSM ()) -> m VideoFrameOutputCallback
newVideoFrameOutputCallback callback = liftDOM (VideoFrameOutputCallback . Callback <$> function (\ _ _ args -> case args ++ P.repeat jsUndefined of
(output : _) -> do
output' <- fromJSValUnchecked output
callback output'))
newVideoFrameOutputCallbackSync :: (MonadDOM m) => (VideoFrame -> JSM ()) -> m VideoFrameOutputCallback
newVideoFrameOutputCallbackSync callback = liftDOM (VideoFrameOutputCallback . Callback <$> function (\ _ _ args -> case args ++ P.repeat jsUndefined of
(output : _) -> do
output' <- fromJSValUnchecked output
callback output'))
newVideoFrameOutputCallbackAsync :: (MonadDOM m) => (VideoFrame -> JSM ()) -> m VideoFrameOutputCallback
newVideoFrameOutputCallbackAsync callback = liftDOM (VideoFrameOutputCallback . Callback <$> asyncFunction (\ _ _ args -> case args ++ P.repeat jsUndefined of
(output : _) -> do
output' <- fromJSValUnchecked output
callback output'))