jsaddle-0.5.1.1: Interface for JavaScript that works with GHCJS and GHC

Safe HaskellNone
LanguageHaskell2010

Language.Javascript.JSaddle.WebSockets

Contents

Description

 

Synopsis

Running JSM over WebSockets

run :: Int -> JSM () -> IO () Source #

Run the given JSM action as the main entry point. Either directly in GHCJS or as a Warp server on the given port on GHC.

syncPoint :: JSM () Source #

Forces execution of pending asyncronous code

syncAfter :: JSM a -> JSM a Source #

Forces execution of pending asyncronous code after performing f

waitForAnimationFrame :: JSM Double Source #

On GHCJS this is waitForAnimationFrame. On GHC it will delay the execution of the current batch of asynchronous command when they are sent to JavaScript. It will not delay the Haskell code execution. The time returned will be based on the Haskell clock (not the JavaScript clock).

nextAnimationFrame :: (Double -> JSM a) -> JSM a Source #

Tries to executes the given code in the next animation frame callback. Avoid synchronous opperations where possible.

Functions used to implement JSaddle over WebSockets

data AsyncCommand Source #

Command sent to a JavaScript context for execution asynchronously

Instances

Show AsyncCommand Source # 
Generic AsyncCommand Source # 

Associated Types

type Rep AsyncCommand :: * -> * #

FromJSON AsyncCommand Source # 
ToJSON AsyncCommand Source # 
type Rep AsyncCommand Source # 
type Rep AsyncCommand = D1 (MetaData "AsyncCommand" "Language.Javascript.JSaddle.Types" "jsaddle-0.5.1.1-LASLszc2AurLhteGD7oTUt" False) ((:+:) ((:+:) ((:+:) (C1 (MetaCons "FreeRef" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend))) ((:+:) (C1 (MetaCons "SetPropertyByName" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSObjectForSend)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSStringForSend)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend))))) (C1 (MetaCons "SetPropertyAtIndex" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSObjectForSend)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend))))))) ((:+:) ((:+:) (C1 (MetaCons "StringToValue" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSStringForSend)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend)))) (C1 (MetaCons "NumberToValue" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Double)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend))))) ((:+:) (C1 (MetaCons "GetPropertyByName" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSObjectForSend)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSStringForSend)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend))))) (C1 (MetaCons "GetPropertyAtIndex" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSObjectForSend)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend)))))))) ((:+:) ((:+:) (C1 (MetaCons "CallAsFunction" PrefixI False) ((:*:) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSObjectForSend)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSObjectForSend))) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [JSValueForSend])) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend))))) ((:+:) (C1 (MetaCons "CallAsConstructor" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSObjectForSend)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [JSValueForSend])) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend))))) (C1 (MetaCons "NewEmptyObject" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend))))) ((:+:) ((:+:) (C1 (MetaCons "NewCallback" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend))) (C1 (MetaCons "NewArray" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [JSValueForSend])) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend))))) ((:+:) (C1 (MetaCons "EvaluateScript" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSStringForSend)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend)))) (C1 (MetaCons "SyncWithAnimationFrame" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend)))))))

data Command Source #

Command sent to a JavaScript context for execution synchronously

Instances

Show Command Source # 
Generic Command Source # 

Associated Types

type Rep Command :: * -> * #

Methods

from :: Command -> Rep Command x #

to :: Rep Command x -> Command #

FromJSON Command Source # 
ToJSON Command Source # 
type Rep Command Source # 
type Rep Command = D1 (MetaData "Command" "Language.Javascript.JSaddle.Types" "jsaddle-0.5.1.1-LASLszc2AurLhteGD7oTUt" False) ((:+:) ((:+:) ((:+:) (C1 (MetaCons "DeRefVal" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend))) (C1 (MetaCons "ValueToBool" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend)))) ((:+:) (C1 (MetaCons "ValueToNumber" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend))) ((:+:) (C1 (MetaCons "ValueToString" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend))) (C1 (MetaCons "ValueToJSON" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend)))))) ((:+:) ((:+:) (C1 (MetaCons "IsNull" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend))) ((:+:) (C1 (MetaCons "IsUndefined" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend))) (C1 (MetaCons "StrictEqual" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend)))))) ((:+:) (C1 (MetaCons "InstanceOf" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSValueForSend)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSObjectForSend)))) ((:+:) (C1 (MetaCons "PropertyNames" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 JSObjectForSend))) (C1 (MetaCons "Sync" PrefixI False) U1)))))