Safe Haskell | None |
---|---|
Language | Haskell2010 |
Language.Javascript.JSaddle.Types
Description
- data JSContextRef = JSContextRef {
- startTime :: UTCTime
- doSendCommand :: Command -> IO Result
- doSendAsyncCommand :: AsyncCommand -> IO ()
- addCallback :: Object -> JSCallAsFunction -> IO ()
- freeCallback :: Object -> IO ()
- nextRef :: TVar JSValueRef
- newtype JSM a = JSM {
- unJSM :: ReaderT JSContextRef IO a
- class (Applicative m, MonadIO m) => MonadJSM m where
- liftJSM :: MonadJSM m => JSM a -> m a
- newtype JSVal = JSVal JSValueRef
- newtype SomeJSArray m = SomeJSArray JSVal
- type JSArray = SomeJSArray Immutable
- type MutableJSArray = SomeJSArray Mutable
- newtype Object = Object JSVal
- newtype JSString = JSString Text
- newtype Nullable a = Nullable a
- type JSCallAsFunction = JSVal -> JSVal -> [JSVal] -> JSM ()
- newtype JSValueReceived = JSValueReceived JSValueRef
- newtype JSValueForSend = JSValueForSend JSValueRef
- newtype JSStringReceived = JSStringReceived Text
- newtype JSStringForSend = JSStringForSend Text
- newtype JSObjectForSend = JSObjectForSend JSValueForSend
- data AsyncCommand
- = FreeRef JSValueForSend
- | SetPropertyByName JSObjectForSend JSStringForSend JSValueForSend
- | SetPropertyAtIndex JSObjectForSend Int JSValueForSend
- | StringToValue JSStringForSend JSValueForSend
- | NumberToValue Double JSValueForSend
- | JSONValueToValue Value JSValueForSend
- | GetPropertyByName JSObjectForSend JSStringForSend JSValueForSend
- | GetPropertyAtIndex JSObjectForSend Int JSValueForSend
- | CallAsFunction JSObjectForSend JSObjectForSend [JSValueForSend] JSValueForSend
- | CallAsConstructor JSObjectForSend [JSValueForSend] JSValueForSend
- | NewEmptyObject JSValueForSend
- | NewCallback JSValueForSend
- | NewArray [JSValueForSend] JSValueForSend
- | EvaluateScript JSStringForSend JSValueForSend
- | SyncWithAnimationFrame JSValueForSend
- data Command
- = DeRefVal JSValueForSend
- | ValueToBool JSValueForSend
- | ValueToNumber JSValueForSend
- | ValueToString JSValueForSend
- | ValueToJSON JSValueForSend
- | ValueToJSONValue JSValueForSend
- | IsNull JSValueForSend
- | IsUndefined JSValueForSend
- | StrictEqual JSValueForSend JSValueForSend
- | InstanceOf JSValueForSend JSObjectForSend
- | PropertyNames JSObjectForSend
- | Sync
- data Batch = Batch [AsyncCommand] Command Bool
- data Result
- = DeRefValResult JSValueRef Text
- | ValueToBoolResult Bool
- | ValueToNumberResult Double
- | ValueToStringResult JSStringReceived
- | ValueToJSONResult JSStringReceived
- | ValueToJSONValueResult Value
- | IsNullResult Bool
- | IsUndefinedResult Bool
- | StrictEqualResult Bool
- | InstanceOfResult Bool
- | Callback JSValueReceived JSValueReceived [JSValueReceived]
- | PropertyNamesResult [JSStringReceived]
- | ThrowJSValue JSValueReceived
- | ProtocolError Text
- | SyncResult
JavaScript Context
data JSContextRef Source #
Identifies a JavaScript execution context. When using GHCJS this is just '()' since their is only one context. When using GHC it includes the functions JSaddle needs to communicate with the JavaScript context.
Constructors
JSContextRef | |
Fields
|
The JSM Monad
The JSM
monad keeps track of the JavaScript execution context.
When using GHCJS it is IO
.
Given a JSM
function and a JSContextRef
you can run the
function like this...
runJSM jsmFunction javaScriptContext
Constructors
JSM | |
Fields
|
class (Applicative m, MonadIO m) => MonadJSM m where Source #
Minimal complete definition
JavaScript Value Types
newtype SomeJSArray m Source #
Constructors
SomeJSArray JSVal |
type JSArray = SomeJSArray Immutable Source #
See JSArray
type MutableJSArray = SomeJSArray Mutable Source #
See MutableJSArray
See Object
See Type
type JSCallAsFunction Source #
Arguments
= JSVal | Function object |
-> JSVal | this |
-> [JSVal] | Function arguments |
-> JSM () | Only () (aka |
Type used for Haskell functions called from JavaScript.
JavaScript Context Commands
newtype JSValueReceived Source #
Wrapper used when receiving a JSVal
from the JavaScript context
Constructors
JSValueReceived JSValueRef |
Instances
newtype JSValueForSend Source #
Wrapper used when sending a JSVal
to the JavaScript context
Constructors
JSValueForSend JSValueRef |
Instances
newtype JSStringReceived Source #
Wrapper used when receiving a JSString
from the JavaScript context
Constructors
JSStringReceived Text |
newtype JSStringForSend Source #
Wrapper used when sending a JString
to the JavaScript context
Constructors
JSStringForSend Text |
Instances
newtype JSObjectForSend Source #
Wrapper used when sending a Object
to the JavaScript context
Constructors
JSObjectForSend JSValueForSend |
Instances
data AsyncCommand Source #
Command sent to a JavaScript context for execution asynchronously
Constructors
Instances
Command sent to a JavaScript context for execution synchronously
Constructors
Batch of commands that can be sent together to the JavaScript context
Constructors
Batch [AsyncCommand] Command Bool |
Result of a Command
returned from the JavaScript context
Constructors