Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- currentWindow :: MonadDOM m => m (Maybe Window)
- currentWindowUnchecked :: MonadDOM m => m Window
- currentDocument :: MonadDOM m => m (Maybe Document)
- currentDocumentUnchecked :: MonadDOM m => m Document
- syncPoint :: JSM ()
- syncAfter :: JSM a -> JSM a
- waitForAnimationFrame :: JSM Double
- nextAnimationFrame :: (Double -> JSM a) -> JSM a
- data AnimationFrameHandle
- inAnimationFrame :: OnBlocked -> (Double -> JSM ()) -> JSM AnimationFrameHandle
- inAnimationFrame' :: (Double -> JSM ()) -> JSM AnimationFrameHandle
- catch :: (MonadCatch m, Exception e) => m a -> (e -> m a) -> m a
- bracket :: MonadMask m => m a -> (a -> m c) -> (a -> m b) -> m b
Documentation
currentWindowUnchecked :: MonadDOM m => m Window Source #
currentDocumentUnchecked :: MonadDOM m => m Document Source #
waitForAnimationFrame :: JSM Double #
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 #
Tries to executes the given code in the next animation frame callback. Avoid synchronous opperations where possible.
data AnimationFrameHandle Source #
:: OnBlocked | what to do when encountering a blocking call |
-> (Double -> JSM ()) | the action to run |
-> JSM AnimationFrameHandle |
Run the action in an animationframe callback. The action runs in a synchronous thread, and is passed the high-performance clock time stamp for that frame.
:: (Double -> JSM ()) | the action to run |
-> JSM AnimationFrameHandle |
Run the action in an animationframe callback. The action runs in a synchronous thread, and is passed the high-performance clock time stamp for that frame. On GHCJS this version will continue asynchronously if it is not possible to complete the callback synchronously.
catch :: (MonadCatch m, Exception e) => m a -> (e -> m a) -> m a #
Provide a handler for exceptions thrown during execution of the first
action. Note that type of the type of the argument to the handler will
constrain which exceptions are caught. See Control.Exception's
catch
.
bracket :: MonadMask m => m a -> (a -> m c) -> (a -> m b) -> m b #
Generalized abstracted pattern of safe resource acquisition and release
in the face of errors. The first action "acquires" some value, which
is "released" by the second action at the end. The third action "uses"
the value and its result is the result of the bracket
.
If an error is thrown during the use, the release still happens before the error is rethrown.
Note that this is essentially a type-specialized version of
generalBracket
. This function has a more common signature (matching the
signature from Control.Exception), and is often more convenient to use. By
contrast, generalBracket
is more expressive, allowing us to implement
other functions like bracketOnError
.