ghcjs-base-0.2.0.0: base library for GHCJS

Safe HaskellNone
LanguageHaskell98

GHCJS.Foreign.Export

Description

Dynamically export Haskell values to JavaScript

Synopsis

Documentation

data Export a Source #

Instances
IsJSVal (Export a) Source # 
Instance details

Defined in GHCJS.Foreign.Export

Methods

jsval_ :: Export a -> JSVal

export :: Typeable a => a -> IO (Export a) Source #

Export any Haskell value to a JavaScript reference without evaluating it. The JavaScript reference can be passed to foreign code and used to retrieve the value later.

The data referenced by the value will be kept in memory until you call releaseExport, even if no foreign code references the export anymore.

withExport :: Typeable a => a -> (Export a -> IO b) -> IO b Source #

Export the value and run the action. The value is only exported for the duration of the action. Dereferencing it after the withExport call has returned will always return Nothing.

derefExport :: forall a. Typeable a => Export a -> IO (Maybe a) Source #

Retrieve the Haskell value from an export. Returns Nothing if the type does not match or the export has already been released.

releaseExport :: Export a -> IO () Source #

Release all memory associated with the export. Subsequent calls to derefExport will return Nothing