Moduleghc-internal-10.0.0Haskell2010
GHC.Internal.JS.Foreign.Callback
Synopsis
- newtype Callback
- data OnBlocked
- value releaseCallback
- value asyncCallback
- value asyncCallback1
- value asyncCallback2
- value asyncCallback3
- value syncCallback
- value syncCallback1
- value syncCallback2
- value syncCallback3
- value syncCallback'
- value syncCallback1'
- value syncCallback2'
- value syncCallback3'
- Packageghc-internal-10.0.0
- Exports15
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceCallback.hs
When you create a callback, the Haskell runtime stores a reference to the exported IO action or function. This means that all data referenced by the exported value stays in memory, even if nothing outside the Haskell runtime holds a reference to to callback. Use releaseCallback to free the reference. Subsequent calls from JavaScript to the callback will result in an exception.
asynchronous callbacks
asyncCallback Make a callback (JavaScript function) that runs the supplied IO action in an asynchronous thread when called. Call releaseCallback when done with the callback, freeing data referenced by the IO action.
synchronous callbacks
syncCallback Make a callback (JavaScript function) that runs the supplied IO action in a synchronous thread when called. Call releaseCallback when done with the callback, freeing memory referenced by the IO action.
syncCallback1 Make a callback (JavaScript function) that runs the supplied IO function in a synchronous thread when called. The callback takes one argument that it passes as a JSVal value to the Haskell function. Call releaseCallback when done with the callback, freeing data referenced by the function.
syncCallback2 Make a callback (JavaScript function) that runs the supplied IO function in a synchronous thread when called. The callback takes two arguments that it passes as JSVal values to the Haskell function. Call releaseCallback when done with the callback, freeing data referenced by the function.
syncCallback3 Make a callback (JavaScript function) that runs the supplied IO function in a synchronous thread when called. The callback takes three arguments that it passes as JSVal values to the Haskell function. Call releaseCallback when done with the callback, freeing data referenced by the function.
synchronous callbacks that return a value
Make a callback (JavaScript function) that runs the supplied IO action in a synchronous thread when called. Call releaseCallback when done with the callback, freeing memory referenced by the IO action.